In AppDelegate, the following:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; customViewController = [[CustomViewController alloc] initWithNibName:@"CustomViewController" bundle:nil]; self.navigationController = [[UINavigationController alloc] initWithRootViewController:customViewController]; [self.navigationController setNavigationBarHidden:YES]; self.window.rootViewController = self.navigationController; [self.window makeKeyAndVisible];
In the actual XIB, the view is associated with βFile Owner,β and this is my only association.
XIB Hierarchy:
Navigation Controller - View Controller - Root View Controller -View (Associated with File Owner)
Sorry if I do not understand this, it worked perfectly in a previously launched application, but I understand that this does not mean that it was correct.
Edit: Sorry, here is the error I get:
* Application termination due to the uncaught exception "UIViewControllerHierarchyInconsistency", reason: "View can be associated with only one view controller! View <UIView: 0xa192d00; frame = (0 20; 320 460); autoresize = W + H; layer = <CALayer: 0xa192d60 β associated with <UIViewController: 0xa195c70>. Clear this association before associating this view with <CustomViewController: 0xa1802a0>. '
source share