开发者

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

开发者 https://www.devze.com 2023-04-12 12:15 出处:网络
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

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号