I have an two controllers
1st is self
and 2nd is maincontroller
, where I\'m pushing maincontroller
in stack
Create your own UIBarButtonItem and set it as the leftBarButtonItem
in viewDidLoad
method of mainController
.
For example (here I used a system item but you can also create a different one, see class reference for details).
UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(showAlertView:)];
self.navigationItem.leftBarButtonItem = leftBarButtonItem;
// only if you don't use ARC
// [leftBarButtonItem release];
where
- (void)showAlertView:(id)sender
{
// alert view here...
}