I have been working on ipad application. In this application I have several views. here is the flow
Welcome Screen > Home Screen > rest of the sreens
I have applied a home icon (button) on navigation bar of all screens. Pressing home icon on any screen takes the user to home screen. I wrote the following code in the viewDidLoad of Home class
//**** Home button on navigation bar ****//
CGRect frame1 = CGRectMake(975.0, 4.0, 35, 35);
UIImage *buttonImage1 = [UIImage imageNamed:@"HomeIcon.png"];
UIButton *homeButton = [UIButton buttonWithType:UIButtonTypeCustom];
homeButton.frame = frame1;
[homeButton setBackgroundImage:buttonImage1 forState:UIControlStateNormal];
homeButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
homeButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[homeButton addTarget:self action:@selector(goHome:) forControlEvents:UIControlEventTouchUpInside];
[homeButton setBackgroundColor:[UIColor clearColor]];
[self.navigationController.navigationBar addSubview:homeButton];
This button is functional. goHome is the name of the method applied in the @selector.
I want to remove this button from home screen and keep it on rest of the screens. I have applied several things but i have no idea how to do it. This seems very simple but still I am not getting it. Please guide..
Regards
PC
In your “Home Screen” viewDidAppear method do this:
In your other View controller where you created the button set tag for home button to 10.
And in you viewDidAppear: of this other view Controller: