UITableView 中的 UIPickerView 对单元格下半部分的触摸没有反应 [英] UIPickerView in UITableView doesn't react to touch in lower half of cell

查看:30
本文介绍了UITableView 中的 UIPickerView 对单元格下半部分的触摸没有反应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个只有一个单元格的 UITableView(稍后我会需要更多),它只包含一个 UIPickerView.UIPickerView 中的单个组件只会在我开始在 UIPickerView 的上半部分触摸它时滚动.如果我的触摸从下半部分开始,它根本不会移动.

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.

我在 UITableView 的界面构建器中设置了以下属性:

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

  • 没有选择
  • 禁用滚动
  • 反弹:没有
  • 弹跳缩放:否
  • 延迟内容接触:否
  • 可取消的内容涉及:否

如何允许触摸从组件中的任何位置滚动 UIPicker?

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

推荐答案

这个问题已经遇到很多次了,它发生的原因通常是两个原因之一

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

  1. 选择器的下半部分顶部有一个视图(尝试将选择器移到视图层次结构的前面)

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

父视图的内容大小不足以覆盖整个选择器.所以只有这个区域内的选择器的一部分是处理触摸

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

这篇关于UITableView 中的 UIPickerView 对单元格下半部分的触摸没有反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆