獲取UINavgationController的退出事件

當我們需要去獲取UINavgationController的退出事件,可在viewWillDisappear用如下方法實現。

代碼:

- (void)viewWillDisappear:(BOOL)animated{

    [super viewWillDisappear:animated];
    
    if (![[self.navigationController viewControllers] containsObject:self])
    {
      
        NSLog(@"用戶點擊了返回按鈕");
    }
   
    
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章