Lets say I have two controller A & B... When I'll navigate from A to B then back button on B Controller will be A.
So my problem is... On a button click I have to change backButton to Cancel Button.. and on another back button it should appear backButton A in back button arrow style.
Please suggest.
Do the following,
To SHOW the Cancel button:
- (void)showCancelButton {
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(someMethod)];
[self navigationItem] setLeftBarButtonItem:cancelButton];
[cancelButton release];
}
To HIDE the Cancel button:
- (void)hideCancelButton {
[self navigationItem] setLeftBarButtonItem:nil];
}
Make sure self.navigationController.navigationItem.hidesBackButton is NO.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With