禁用UIPickerView中的特定行值 [英] Disable particular row value in UIPickerView

查看:148
本文介绍了禁用UIPickerView中的特定行值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试禁用pickerView中的特定行。

I am trying to disable particular row in pickerView.

我有一个pickerView的字符串数组。当用户选择特定行时,我在array1中追加值。

I have an array of strings for pickerView. I am appending values in array1 when user selects particular row.

之后我想在用户再次打开pickerView时执行此操作,如果array1具有数组值,则应禁用pickerView的值。

After that I want to do that when user again opens pickerView if array1 has values of array, pickerView's that value should be disabled.

我该怎么做?

推荐答案

选项1:禁用元素

您可以使用方法 pickerView:attributionTitleForRow:forComponent:

然后,当使用 pickerView:didSelectRow:inComponent:

选项2:删除商品

第二个选项是从可能的选项中删除商品通过调整数据源来离子。

The second option would be to just remove the item from the possible options by adjusting your datasource.

这篇关于禁用UIPickerView中的特定行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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