A button is added to the navigation bar which is shown on all the screens. I need to hide it from all screens except one
In my app for iPad, I have first a welcome 开发者_高级运维screen then home screen and then home screen navigates to rest of the screens. I have made a button on navigation bar of the home screen which takes the user back to the welcome screen. But that button is shown on all other screens as well. I want to remove that button from all the screens and show it only in the home screen. How can I hide that button from all other screens and make it visible only on the home screen?
Thanks PC
In viewDidDisappear:
self.navigationItem.rightBarButtonItem = nil;
// or on whichever side your button is
In viewWillAppear:
self.navigationItem.rightBarButtonItem = self.showWelcomeButton;
// self.showWelcomeButton is a retained UIBarButtonItem property
精彩评论