ios5.1 UITapGestureRecognizer UIControlEventTouchUpInside
2014-03-31 10:30
567 查看
在UIButton的superview中定义一个手势,在iOS5上UIButton事件不会被执行,会执行手势事件,iOS6上已经没有这个问题了,解决方法:
手势添加委托,委托方法:
本文出自 “奋斗” 博客,请务必保留此出处http://zmhot88.blog.51cto.com/1338337/1387274
手势添加委托,委托方法:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { // test if our control subview is on-screen if (_view.superview != nil) { if ([touch.view isDescendantOfView:_view] && [touch.view isKindOfClass:[UIButton class]]) { // we touched our control surface return NO; // ignore the touch } } return YES; // handle the touch }这样手势不再执行,会执行UIButton的点击事件。
本文出自 “奋斗” 博客,请务必保留此出处http://zmhot88.blog.51cto.com/1338337/1387274
相关文章推荐
- ScrollView上加Button UIControlEventTouchUpInside事件超出边界扔响应问题
- 在ib中为button 增加的action相应UIControlEventTouchUpInside 事件
- UIWebView上Touch/UITapGestureRecognizer事件的最简单的方法
- 给button增加点击事件时这个地方也加上了 UIControlEventTouchUpOutside 这个
- iPhone开发--检查UIWebView上Touch/UITapGestureRecognizer事件的最简单的方法(转载)
- UIButton inside a view that has a UITapGestureRecognizer
- UITapGestureRecognizer 的使用,判断点击哪个控件
- 21. 手势识别之UITapGestureRecognizer
- UITapGestureRecognizer手势识别(双击、捏、旋转、拖动、划动、长按)
- 在view上加UITapGestureRecognizer,按钮不触发单击事件的处理方法
- UITableView添加UITapGestureRecognizer与didSelectRowAtIndexPath冲突解决
- 解决UITapGestureRecognizer手势与UITableView的点击事件的冲突
- 手势UITapGestureRecognizer的tag
- iphone练习之手势识别(双击、捏、旋转、拖动、划动、长按)UITapGestureRecognizer
- iOS中添加UITapGestureRecognizer手势识别后,UITableView的didSelectRowAtIndexPath失效
- 关于UITapGestureRecognizer屏蔽Button的处理
- UITapGestureRecognizer 的用法
- UITapGestureRecognizer 的用法
- 关于 UITapGestureRecognizer 一些注意的地方
- UITapGestureRecognizer