选择器视图问题

发布于 2024-10-30 13:59:23 字数 159 浏览 3 评论 0原文

我有 2 段 UIPickerView 一个有数字,第二个“数量”

两个段都没有作为其第一个索引。

我想做的是,每当我从段中选择 None(第一个元素)时, 另一个段的相应第一个元素也应该移动到 None (这是自动的第一个元素。) 有道理吗??

需要指导

I have 2 segment UIPickerView
one is having number and second "Quantity"

Both segment has None as their first index.

what i m trying to do is, whenever i choose None(first element) from an of the segment,
the respective, first element of the other segment should also move to None(which is first element,automatically.)
Makes sense??

Guidance needed

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天涯离梦残月幽梦 2024-11-06 13:59:23

这很简单,代码如下:

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    if (row == 0) {
        [pickerView selectRow:0 inComponent:((component+1)%1) animated:YES];
    }
}

This is pretty simple, here's the code:

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    if (row == 0) {
        [pickerView selectRow:0 inComponent:((component+1)%1) animated:YES];
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文