I have an navigation controller, I have pushed two views into that. I want to show a button in navigation bar, which should be shown in all views. But when I’m trying like this…
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:[UIImage imageNamed:@"logo-57.png"] forState:UIControlStateNormal];
[button addTarget:self action:@selector(backButtonClicked) forControlEvents:UIControlEventTouchUpInside];
[button setFrame:CGRectMake(-2, 0, 57, 57)];
UIBarButtonItem *btnItem = [[UIBarButtonItem alloc] initWithCustomView:button];
root_obj_ab.navigationItem.rightBarButtonItem = btnItem;
It is adding in the local view where I am writing the code. How to set the button for all views?
TIA
What about creating a custom view controller which has this button and then make all your view controllers as subclasses of that custom one?