UIPickerView in UITableView doesn't react to t

2019-09-17 00:43发布

问题:

I have a UITableView with one cell only (I will need more later) that contains just a UIPickerView. The single component in the UIPickerView will only scroll when I begin touching it in the top half of the UIPickerView. It will not move at all if my touch starts in the lower half.

I have set the following properties in interface builder for the UITableView:

  • No selection
  • Scrolling disabled
  • Bounces: NO
  • Bounces Zoom: NO
  • Delays Content Touches: NO
  • Cancellable Content Touches: NO

How can I allow touches to scroll the UIPicker from anywhere in the component?

回答1:

Have faced this issue many times now and it happens usually due to one of the 2 reasons

  1. There is a view on top of the picker's bottom half (try moving the picker to the front in view hierarchy)

  2. The content size of the parent view is not large enough to cover the entire picker. So only the part of the picker present inside this area is handling touches