zoukankan      html  css  js  c++  java
  • 拦截iOS系统导航栏返回按钮事件-三种方法

    方法一:在dealloc里面书写监听事件,因为只有pop才会调用dealloc,push不会掉用

    - (void)dealloc {YLLog(@"123"); }

    方法二:在- (void)viewWillDisappear:(BOOL)animated中调用

    - (void)viewWillDisappear:(BOOL)animated{

      if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {

        NSLog(@"clicked navigationbar back button");

      }

    }

    方法三:重写返回按钮,然后调用返回按钮的方法即可:如

    - (void)popViewcontrollerFunc {

      UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"确定要放弃到手的奖品吗" delegate:self cancelButtonTitle:@"点错啦" otherButtonTitles:@"狠心放弃", nil];alert.tag = 10001;[alert show];

    }

  • 相关阅读:
    0827IO作业
    0927集合作业
    初学集合,以及泛型
    异常课——抛出
    Python环境变量配置
    安装Python
    MySQL多表操作
    MySQL增删改查
    Group by分组详解
    MySQL常用函数
  • 原文地址:https://www.cnblogs.com/Im-Victor/p/13392181.html
Copyright © 2011-2022 走看看