IOS初始化控制器的实现方法总结
来源:爱站网时间:2020-02-09编辑:网友分享
在IOS开发过程中,常常需要使用显示表单、数据、图片、按钮和其他方法,下面就由爱站技术频道小编介绍的IOS初始化控制器的实现方法总结,一起进入下文学习吧!
在IOS开发过程中,常常需要使用显示表单、数据、图片、按钮和其他方法,下面就由爱站技术频道小编介绍的IOS初始化控制器的实现方法总结,一起进入下文学习吧!
IOS初始化控制器的实现方法总结
一.ViewControllViewController方法
#import "AppDelegate.h"
#import "ViewController.h"
@interface AppDelegate ()
@property(nonatomic,strong) ViewController *viewController;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//初始化控制器
self.viewController = [[ViewController alloc]init];
//初始化window
self.window =[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
//设置控制器
self.window.rootViewController = self.viewController;
return YES;
}
二 .ViewControllViewController 与 xib方法
#import "AppDelegate.h"
#import "XibViewControllViewController.h"
@interface AppDelegate ()
@property(nonatomic,strong) ViewController *viewController;
@property(nonatomic,strong) XibViewControllViewController *xibControllViewController;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//初始化控制器
self.xibControllViewController = [[XibViewControllViewController alloc]initWithNibName:@"XibViewControllViewController" bundle:nil];
//初始化window
self.window =[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
//设置控制器
self.window.rootViewController = self.xibControllViewController;
return YES;
}
关于IOS初始化控制器的实现方法总结的话题爱站技术频道小编就说到这里了,希望大家能多多支持我们,专业的技术资讯等你探索。
