Where ever you initially create your MainViewController
(and most likely assign it to the windows rootViewController
property) wrap this in a UINavigationController
.
MainViewController *mainViewController = [MainViewController new];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:mainViewController];
You code in your question is then correct, and those UIBarButtonItem
s will then show in the navigation bar.