you could make your own action to BackButton:
[self.navigationItem.backBarButtonItem setAction:@selector(action:)];
-(void) action:(id)sender {
//do something here
[self.navigationController popViewControllerAnimated:YES];
}
Pregunta
I am trying to detect when the user pressed the back button in a GLKViewController. The view controller is presented via a storyboard from the root view controller (which is a menu).
The problem is that I cannot detect when the back button is pressed (so I can free up memory).
I have tried :
if (self.isMovingFromParentViewController) {
// Do your stuff here
NSLog(@"Dismissed");
}
And
if (self.isBeingDismissed) {
// Do your stuff here
NSLog(@"Dismissed");
}
Neither of which fires. Can anyone suggest why ?
Solución
you could make your own action to BackButton:
[self.navigationItem.backBarButtonItem setAction:@selector(action:)];
-(void) action:(id)sender {
//do something here
[self.navigationController popViewControllerAnimated:YES];
}