码迷,mamicode.com
首页 > 其他好文 > 详细

如何监听状态栏的点击

时间:2016-04-10 14:05:48      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:

https://www.zybuluo.com/keenleung/note/339982

  • 注意点:

    • 无法从控制器中获取状态栏
    • 状态栏是属于一整个应用程序的,需要在 AppDelegate监听其状态
  • 做法:

/**
* 可以在这个AppDelegate方法中监听到状态栏的点击
*/
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
// 防止事件的传递过程中, 某些控制器的点击事件传递到 AppDelegate 中
if ([touches.anyObject locationInView:nil].y > 20) return;
NSLog(@"点击了状态栏")
}

 

 

如何监听状态栏的点击

标签:

原文地址:http://www.cnblogs.com/KeenLeung/p/5373837.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!