UIPickerView禁用行选择 [英] UIPickerView disable row selection

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

问题描述

我想在 UIPickerView 中禁用某些行的选择。就像在Coundown计时器中,你尝试选择0,它不会让你回到1.或者如何限制日期选择器中的日期 ...

I want to disable the selection of certain rows in my UIPickerView. Like in the Coundown timer, where you try to choose 0, it doesn't let you and slips back up to 1. Or how you can limit the date in the Date Picker...

如何禁用 UIPickerView 中的行?

推荐答案

UIPickerView 委托方法

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component

您可以检查此选择是否有效,如果不是,则滚动到相应的行(使用pickerview的

you can check if this selection is valid and scroll to the appropriate row if it is not (using pickerview's

- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated

方法。)

标准的Clock应用程序看起来是这样的。

It looks that standard Clock application works this way.

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

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