UIPickerView inside UITableView.tableFooterView doesn't receive drag touches

 ̄綄美尐妖づ 提交于 2019-12-01 19:44:36

Here's what ended up working.

I made my table into a subclass of UITableView (called PickerSensitiveUITableView).

The I implemented this method:

- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
    UIView* result = [super hitTest:point withEvent:event];

    if ([result.superview isKindOfClass:[UIPickerView class]])
    {
          self.scrollEnabled = NO;
    }
    else 
    {
          self.scrollEnabled = YES;    
    }
    return result;
}

So now when the touch happens inside the bounds of the picker (actually ANY picker in the table!) it turns off the scrollability of the UITableView.

It occurs to me a more general solution would be to do this as a category on UIScrollView. The problem isn't with tables so much as with the UIScrollView that UITableView is a subclass of...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!