UIPickerView 禁用列
如何禁用 UIPickerView 列?
我只想禁用一列选择器。假设我有 3 列的选择器,我想禁用第二列。
How can i disable UIPickerView column?
I want to disable only one column of picker. Lets say i have picker with 3 column and i want to disable second column.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里有几个选项。
1) 捕获与第二列的交互并覆盖它。
实现此方法可以简单地返回到选择之前的位置。但是,他们仍然能够与第二列交互。
2) 只需将色谱柱从选取器中取出即可。
我相信这是最好的选择。有一些布尔值“showSecondColumn”。然后,在:
您可以简单地检查您的小标志并返回适当的数字。 UIPickerView 有一个方法:
reloadAllComponents
祝你好运!
There are a couple options here.
1) Capture interaction with the second column and override it.
This method can be implemented to simply go back to where it was before the selection. However, they will still be able to interact with the second column.
2) Simply remove the column from the picker.
I believe this is the best option. Have some boolean 'showSecondColumn'. Then, in:
you can simply check your little flag and return the appropriate number. UIPickerView has a method:
reloadAllComponents
Good luck!
似乎没有办法禁用列。我解决了(不是最好的解决方案),如下所示:
如果有任何更好的方法那就太好了。
It seems there is no way to disable column. I solved(not best solution) like this:
If there is any better way it would be great.