开发者

Limiting number of selections to one cell/row per group in a grouped UITableView on iPhone

I´m working on a quiz application which uses a grouped UITab开发者_StackOverflowleView, where i need to limit the users selection to one cell per group and also make the group selectable only once per group, in order to stop the user from correcting any potential wrong answers. Is there any way of doing this?

Cheers, Adam


You can select only one row in UITableView so it is not correct approach for you. You should look into using accessory views (e.g. using UITableViewCellAccessoryCheckmark type) and handle it in delegate's -didSelectRowAtIndexPath method - it is explicitely described in Apple's docs.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜