Remove button from navigation bar of all screens and show it to only one screen.

Feb 21, 2011
Reaction score
Your Mac's Specs
Macbook Air 11", 64 GB, Intel core i5, 1.6 GHz, OSX Lion 10.7
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?

Here is the code which I wrote for that button in viewDidLoad of Home:

CGRect frame4 = CGRectMake(10.0, 0.0, 40.0, 40.0);
UIImage *buttonImage4 = [UIImage imageNamed:@"InfoIcon.png"];
UIButton *InfoButton = [UIButton buttonWithType:UIButtonTypeCustom];
InfoButton.frame = frame4;
[InfoButton setBackgroundImage:buttonImage4 forState:UIControlStateNormal];
InfoButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
InfoButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[InfoButton addTarget:self action:@selector(info) forControlEvents:UIControlEventTouchUpInside];
[InfoButton setBackgroundColor:[UIColor clearColor]];
[self.navigationController.navigationBar addSubview:InfoButton];


Shop Amazon

Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.