/ Published in: iPhone
URL: http://www.comanswer.com/question/setting-action-for-back-button-in-navigation-controller
Code taken from comment by 'William Jockusch' in the URL.
Expand |
Embed | Plain Text
-(void) viewWillDisappear:(BOOL)animated { if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) { // back button was pressed. We know this is true because self is no longer // in the navigation stack. } [super viewWillDisappear:animated]; }
Comments
Subscribe to comments
You need to login to post a comment.

if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound)should be written asif (![self.navigationController.viewControllers containsObject:self])