0
所以我在我的didFinishLaunchingWithOptions中有以下代碼。問題是,如果我去掉下面的addSubView和makeKeyVisible MainViewController的viewDidLoad被調用兩次:應用程序委託和viewDidLoad調用兩次
MainViewController * tabBarController = [[MainViewController alloc] init];
navigationController.delegate = self;
//[self.window addSubview:navigationController.view];
//[self.window makeKeyAndVisible];
[tabBarController release];
[application registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|
UIRemoteNotificationTypeAlert|
UIRemoteNotificationTypeSound];
return YES;
誰能告訴我,爲什麼,以及如何防止這種情況?對我來說,當你實際分配一個UIViewController時,它調用viewDidLoad並不合理。