在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初始化控制器的實現方法總結的話題武林技術頻道小編就說到這里了,希望大家能多多支持我們,專業的技術資訊等你探索。
新聞熱點
疑難解答