So I have the following code in my didFinishLaunchingWithOptions. The issue is that MainViewController’s viewDidLoad is called twice if I uncomment the addSubView and makeKeyVisible below:
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;
Can anyone tell me why and how to prevent this? For me it doesn’t quite make sense that when you actually alloc a UIViewController it calls the viewDidLoad.
It does make sense. From UIViewController header: