문제

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 ?

도움이 되었습니까?

해결책

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];

}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top