Hello
I am developing an app which is using a tableview with two sections(instead of radio buttons).
So I want these section to act like radio buttons. To accomplish this, I have to implement an “if” in the
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
I want to use something like: if (section == “A”).
How to do that?
Also is this the right way to make the sections of a table acting like a different tables?
Hmm… that sounds like an odd set up, but irrespective, you simply use the provided
indexPathto obtain the section/row.i.e.:
indexPath.sectionwill point to the selected section andindexPath.rowwill point to the row.For more information, the Table View Programming Guide for iOS is a good start as it covers all of the above in quite a bit of detail.
UPDATE
In terms of highlighting multiple cells, I’d have thought that you’d want to create your own concept of highlighting, which you’d toggle on and off when the user selects the cell.
That said, you could also mark selected cells via the
UITableViewCellAccessoryCheckmarkas per the existing Is it possible to configure a UITableView to allow multiple-selection? question/answer.