I'm having a problem using the new iOS 5 feature to select multiple cells in edit mode. The structure of the application is as follows:
-> UIViewController ---> UITableView ----> CustomUITableViewCell
where the UIViewController is both the delegate and the data source for the UITableView (instead, I use the UIViewController instead of the UITableViewController and I cannot change it). Cells are loaded into a UITableView as the following 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; }
The cell interface was created from an xib file. In particular, I created a new xib file in which the supervisor consists of a UITableViewCell element. To provide customization, I set the type for this element as CustomUITableViewCell , where CustomUITableViewCell extends UITableViewCell .
@interface CustomTableViewCell : UITableViewCell // do stuff here @end
The code works well. The table displays custom cells. Now, while the application is running, I set allowsMultipleSelectionDuringEditing to YES , and I enter edit mode for the UITableView . Seems to work. In fact, an empty circle appears next to each cell. The problem is that when you select a row, an empty circle does not change its state. Theoretically, the circle should change from empty to a red checkmark and vice versa. The circle seems to stay above the contentView for the cell.
I have done many experiments. I also checked that the following method.
- (NSArray *)indexPathsForSelectedRows
and it is updated during the selection in edit mode. It displays the selected cells.
What is not so clear to me is that when I try to work without a special cell, only with UITableViewCell , the circle updates its state correctly.
Do you have any suggestions? Thank you in advance.