This works great:
UINavigationController *nc =
[[UINavigationController alloc]
initWithNavigationBarClass:[GTScrollNavigationBar class]
toolbarCl
self.window.rootViewController.viewControllers = @[firstPage];
does not compile because the rootViewController
property of UIWindow
is declared
as a (generic) UIViewController
(which does not have a viewControllers
property), and not as a UINavigationController
.
The compiler does not "know" that the root view controller is actually a navigation controller in your case.
So either you proceed as in your first code block, or you have to add an explicit cast:
((UINavigationController *)self.window.rootViewController).viewControllers = @[firstPage];