[英]Interactive Pop Gesture Recognizer blocking button touchupinside event in custom uitableviewcell
I have a UITableViewController that is pushed from a RootViewController. 我有一个从RootViewController推送的UITableViewController。 In the UITableView for the UITableViewController, I'm using a custom cell which has a button at the left with frame: CGRectMake(0,0,30,30).
在UITableViewController的UITableView中,我正在使用一个自定义单元格,该单元格的左侧带有一个带有框架的按钮:CGRectMake(0,0,30,30)。
It seems like when I set self.navigationController.interactivePopGestureRecognizer.enabled = NO; 好像当我设置self.navigationController.interactivePopGestureRecognizer.enabled = NO; in the UITableViewController, the touch events for the button are received, but if I set it to enabled = YES, the touch events on the button are lost:
在UITableViewController中,会收到按钮的触摸事件,但是如果我将其设置为enabled = YES,则会丢失按钮上的触摸事件:
Here's my code for creating the button inside the custom tableviewcell. 这是我的代码,用于在自定义tableviewcell内部创建按钮。
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0,0,30,30);
[button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:button];
Any thoughts/suggestions on how I can fix this would be appreciated! 关于如何解决此问题的任何想法/建议,将不胜感激!
Thanks. 谢谢。
Set the cancelsTouchesInView
property on the gesture recognizer to NO
. 将手势识别器上的
cancelsTouchesInView
属性设置为NO
。 The default is YES
, which means the view to which it's attached won't get to also handle the touches. 默认值为
YES
,这意味着它所连接的视图也无法处理触摸。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.