Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try the options suggested in these posts <a href="https://stackoverflow.com/questions/1231427/how-to-apply-check-mark-on-table-view-in-iphone-using-objective-c">how to apply check mark on table view in iphone using objective c?</a> or <a href="https://stackoverflow.com/questions/5959950/iphone-uitableview-cellaccessory-checkmark">iPhone :UITableView CellAccessory Checkmark</a> </p> <p>Basically you need to keep track of the checkmarks using say a dictionary or so. And In <code>viewDidLoad</code> or <code>init</code> method make the first cell as checked in the dictionary. While drawing cells, always check if the corresponding entry in the dictionary is checked or not and display check mark accordingly. When user taps on a cell, modify the value in dictionary to checked/unchecked.</p> <p><strong>Update:</strong> Here is a sample code.</p> <p>In .h file declare a property as</p> <pre><code>@property(nonatomic) NSInteger selectedRow; </code></pre> <p>Then use the below code,</p> <pre><code>- (void)viewDidLoad { //some code... self.selectedRow = 0; //if nothing should be selected for the first time, then make it as -1 //create table and other things } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // create cell and other things here if (indexPath.row == self.selectedRow) { cell.accessoryType = UITableViewCellAccessoryCheckmark; } else { cell.accessoryType = UITableViewCellAccessoryNone; } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // some other code.. if (indexPath.row != self.selectedRow) { self.selectedRow = indexPath.row; } [tableView reloadData]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload