iphone - 将 iPhone 上分组 UITableView 中的选择数量限制为每组一个单元格/行

标签 iphone uitableview select

我正在开发一个使用分组 UITableView 的测验应用程序,其中我需要将用户的选择限制为每组一个单元格,并且还使每个组只能选择一次该组,以阻止用户更正任何内容潜在的错误答案。有什么办法可以做到这一点吗?

干杯,亚当

最佳答案

您只能在 UITableView 中选择一行,因此这对您来说不是正确的方法。您应该考虑使用附件 View (例如使用 UITableViewCellAccessoryCheckmark 类型)并在委托(delegate)的 -didSelectRowAtIndexPath 方法中处理它 - Apple 文档中有明确描述。

Discussion
The delegate handles selections in this method. One of the things it can do is exclusively assign the check-mark image (UITableViewCellAccessoryCheckmark) to one row in a section (radio-list style). See "Managing Selections" in Table View Programming Guide for iPhone OS for further information (and code examples) related to this method.

关于iphone - 将 iPhone 上分组 UITableView 中的选择数量限制为每组一个单元格/行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2206339/

相关文章:

iphone - 在其他 View 中更改 UItabbaritem 的标题?

iphone - 通过 iTunes Connect 应用程序传输后配置配置文件

ios - 如何检测应用程序是否在越狱设备上运行?

iphone - 将 CALayer 添加到 UIView 并能够在方向更改时重绘

php - 无法在 php 中访问 mySql 结果

iphone - 当 UITextField 失去焦点时隐藏键盘

iOS TableView 自定义单元格不显示任何内容

iphone - iOS 7 下 UITableView 部分索引相关的崩溃

sql - 选择相关表中具有两个值的行

mysql - select mysql 查询的性能真的很差