Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom UITableViewCell, UITableView and allowsMultipleSelectionDuringEditing
    text
    copied!<p>I have a problem using <strong>iOS 5</strong> new functionality to select multiple cells during editing mode. The application structure is the following:</p> <pre><code>-&gt; UIViewController ---&gt; UITableView ----&gt; CustomUITableViewCell </code></pre> <p>where <code>UIViewController</code> is both the delegate and the data source for the <code>UITableView</code> (I'm using an <code>UIViewController</code> instead of <code>UITableViewController</code> for requirement reasons and I cannot change it). Cells are loaded into the <code>UITableView</code> like the following code.</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomTableViewCell *cell = (CustomTableViewCell*)[tv dequeueReusableCellWithIdentifier:kCellTableIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"CustomTableViewCellXib" owner:self options:nil]; cell = self.customTableViewCellOutlet; cell.selectionStyle = UITableViewCellSelectionStyleNone; } // configure the cell with data [self configureCell:cell atIndexPath:indexPath]; return cell; } </code></pre> <p>The cell interface has been created from a xib file. In particular, I've created a new xib file where the superview consists of a <code>UITableViewCell</code> element. To provide customization, I set the type for that element as <code>CustomUITableViewCell</code>, where <code>CustomUITableViewCell</code> extends <code>UITableViewCell</code>.</p> <pre><code>@interface CustomTableViewCell : UITableViewCell // do stuff here @end </code></pre> <p>The code works well. In the table custom cells are displayed. Now, during application execution I set <code>allowsMultipleSelectionDuringEditing</code> to <code>YES</code> and I enter the edit mode for the <code>UITableView</code>. It seems working. In fact, alongside of each cell an empty circle appears. The problem is that when I select a row the empty circle doesn't change its state. In theory, the circle has to change from empty to red checkmark and viceversa. It seems that circle remains above the <code>contentView</code> for the cell.</p> <p>I've made a lot of experiments. I've also checked also that following method.</p> <pre><code>- (NSArray *)indexPathsForSelectedRows </code></pre> <p>and it gets updated during selection in editing mode. It displays the right selected cells.</p> <p>The thing that it's not so clear to me is that when I try to work without a custom cell, only with <code>UITableViewCell</code>, the circle updates its state correctly.</p> <p>Do you have any suggestion? Thank you in advance.</p>
 

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