独立双拣选机

发布于 2024-10-06 04:06:45 字数 92 浏览 0 评论 0原文

我有双选择器,一个选择器用于卡片的花色(红心,钻石等),另一个用于卡片的价值(国王,十,二等)。我想知道一旦已经选择了卡片选择器中的值,如何将其消除,以便无法再次选择它?

I have double picker one picker for suit (heart, diamond etc) of a card and the other the value of the card (king, ten, two etc). What I want to know how do I eliminate a value from the card picker once it was already selected so it cant be chosen again?

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

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

发布评论

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

评论(1

空袭的梦i 2024-10-13 04:06:45

将 UIPickerView 的数据存储在 NSMutableArray 中。然后,当用户做出选择时,从数据源数组中删除这些对象,并调用

[self.myPickerView reloadAllComponents];

当然,只有当您没有对 numberOfRowsInComponent: 的值进行硬编码,而是执行某些操作时,这才会起作用。喜欢

- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
    return [dataArray count];
}

Keep your UIPickerView's data stored in an NSMutableArray. Then, when the user makes his choices, remove those objects from the data source array, and call

[self.myPickerView reloadAllComponents];

This will only work, of course, if you're not hardcoding the value for numberOfRowsInComponent:, but doing something like

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