2
這是一個好的方法來設置一個自定義的ViewController作爲窗口的rootViewController嗎?分配一個自定義的ViewController作爲窗口的rootViewController
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window.rootViewController = [[[CustomViewController alloc]init] autorelease];
[self.window makeKeyAndVisible];
return YES;
}
在大多數的蘋果公司的例子,他們首先聲明一個viewController
屬性,然後:
RootViewController* theRVC = [[RootViewController alloc] init];
self.viewController = theRVC;
[theRVC release];
[self.window addSubview:self.rvc.view];
[self.window makeKeyAndVisible];
什麼,這是推薦這兩種方法之間的性差異?
此討論可能有所幫助:http://stackoverflow.com/questions/5842087/programming-ios-clarifications-about-root-view-controller – Davyd