Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You're going to have to maintain a list yourself to determine which cells should be checked or not. Remember that in <code>tableView:cellForRowAtIndexPath:</code>, a proper implementation will recycle cells so that you never have more than 10-15 cells instantiated. This can cause some funky results if you don't handle for it properly. When I've done a poor implementation, I've seen certain cell properties "carry over" from one cell to the next.</p> <p>Anyway, here's what I'd recommend (based on what I think you're asking): <br /> 1. Create a class to back each UITableViewCell <br /> 2. Create a property in that class to determine which of the two checkboxes (or neither or both) should be checked. <br /> 3. In your ViewController/TableViewController, maintain an NSMutableArray/NSArray where 1 item in the array = 1 cell in the UITableView. <br /> 4. In your <code>tableView:cellForRowAtIndexPath:</code> method, get a reference to the appropriate item in your array. <br /> 5. Then, check that instance's properties and set the checkbox values appropriately. <br /> <br /> <hr> Sample Code:</p> <p>TableView.h</p> <pre><code>@interface TableView : UITableViewController @property (strong, nonatomic) NSMutableArray *itemArray; @end </code></pre> <p>TableView.m</p> <pre><code>@implementation TableView @synthesize itemArray; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // Assume you get a valid, custom UITableViewCell at this point (named "cell") // Configure the cell... NSObject *classItem = [[self itemArray] objectAtIndex:[indexPath row]]; [[cell checkBox1] setChecked:[classItem checkbox1Checked]]; [[cell checkBox2] setChecked:[classItem checkbox2Checked]]; return cell; } @end </code></pre>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    1. 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