监听返回
popViewController回调用dealloc
- (void)dealloc {
NSLog(@"123");
}
viewWillDisappear将要消失
- (void)viewWillDisappear:(BOOL)animated{
if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {
NSLog(@"clicked navigationbar back button");
}
}
重写leftbarItem
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back_icons"] style:UIBarButtonItemStylePlain target:self action:@selector(onBack)];