如何从UIPickerview取消选择行 [英] How to deleselect a row from UIPickerview
问题描述
我正在使用picker view
,默认情况下它选择第一行.我不要这个选项.例如,我有否"和是"选项.如果我在pickerview中提供此选项,则在pickerview中将选择否"(附加屏幕快照).我不需要.我需要将第一行作为空白.一旦用户选择如果选择否"或是",则只需将其显示为选定的行即可.相关屏幕截图如下.
怎么做到的?
Hi I am using picker view
, by default it is selecting the first row. I don't want this option. For example I am having "No" and "yes" options.If i give this option in pickerview "No " will be selected in pickerview (attached screenshot).I dont need this.I need first row as empty .once the user selects on "No" or "Yes" then only it need to show as a selected row. Related screenshot attached below.
How to this?
提前谢谢.
推荐答案
如果要使用UIPickerView
来获取此代码,则将选择器视图的第一个component
作为空值传递,否则可以使用custom pickerview
.
If you want to get this one by using UIPickerView
then pass the first component
of the picker view as a empty value,otherwise you can use custom pickerview
.
[pickerArray addObject:@""];//first element of the picker component.
这篇关于如何从UIPickerview取消选择行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!