Change the following line:
[_window addSubview:[_navigationControllerview]];
to:
_window.rootViewController =_navigationController;
or, if you need iOS 3 compatibility:
if ([_windowrespondsToSelector:@selector(setRootViewController:)]){
_window.rootViewController = _navigationController;
} else {
[_window addSubview:_navigationController.view];
}
In iOS 4 and later, UIWindow has the settable property rootViewController. This is the UINavigationController that pushes the UIViewController displayed on applicationlaunch. In Xcode IB, selecting Initial Scene: Is initial view controllerfor the UINavigationController sets everything up with no code required.