UINavigationController检测后退按钮被按下

  1. -(void) viewWillDisappear:(BOOL)animated    
  2. {   
  3.     if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound)    
  4.     {   
  5.         // back button was pressed.  We know this is true because self is no longer   
  6.         // in the navigation stack.     
  7.         NSLog(@"viewWillDisappear:(BOOL)animated ");   
  8.         if(request)   
  9.         {   
  10.             [request clearDelegatesAndCancel];   
  11.             request.delegate = nil;   
  12.             [request release];   
  13.             request = nil;   
  14.         }   
  15.     }   
  16.     [super viewWillDisappear:animated];   
  17. }  
http://www.cnblogs.com/zhwl/archive/2012/08/11/2633498.html
原文地址:https://www.cnblogs.com/likwo/p/2635514.html