IOS初始化控制器的實(shí)現(xiàn)方法總結(jié)
IOS初始化控制器的實(shí)現(xiàn)方法總結(jié)
一.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]; //設(shè)置控制器 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]; //設(shè)置控制器 self.window.rootViewController = self.xibControllViewController; return YES; }
如有疑問請(qǐng)留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
相關(guān)文章
iOS頁面跳轉(zhuǎn)及數(shù)據(jù)傳遞(三種)
本文主要介紹了iOS頁面跳轉(zhuǎn)的三種方法及數(shù)據(jù)傳遞的方法。具有很好的參考價(jià)值。下面跟著小編一起來看下吧2017-03-03iOS中使用Fastlane實(shí)現(xiàn)自動(dòng)化打包和發(fā)布
Fastlane是一套使用Ruby寫的自動(dòng)化工具集,用于iOS和Android的自動(dòng)化打包、發(fā)布等工作,可以節(jié)省大量的時(shí)間。下面給大家介紹ios fastlane 自動(dòng)化打包和發(fā)布的安裝方法,需要的朋友參考下吧2017-05-05實(shí)例講解iOS音樂播放器DOUAudioStreamer用法
本篇文章給大家通過實(shí)例講解了iOS音樂播放器DOUAudioStreamer用法以及分享了實(shí)例代碼,一起學(xué)習(xí)參考下吧。2017-12-12iOS自定義View實(shí)現(xiàn)卡片滑動(dòng)
這篇文章主要為大家詳細(xì)介紹了ios自定義View實(shí)現(xiàn)卡片滑動(dòng)效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-02-02iOS UIAlertController中UITextField添加晃動(dòng)效果與邊框顏色詳解
這篇文章主要給大家介紹了關(guān)于iOS UIAlertController中UITextField添加晃動(dòng)效果與邊框顏色的相關(guān)資料,實(shí)現(xiàn)后的效果非常適合在開發(fā)中使用,文中給出了詳細(xì)的示例代碼,需要的朋友可以參考借鑒,下面隨著小編來一起看看吧。2017-10-10iOS使用runtime修改文本框(TextField)的占位文字顏色
相信大家都知道TextField默認(rèn)的占位顏色也是深灰色,這個(gè)顏色比較難看清,這篇文章給大家介紹如何使用runtime修改TextField文本框的占位文字顏色,有需要的可以參考借鑒.2016-09-09