Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // i have a cell subclass and i want to be able to select multiple rows for move/delete
- // i returned UITableViewCellEditingStyleNone in the delegate method and i added this frame offset where i want to // toogle between 2 images(selected and not selected).
- UIImageView *aView = [[UIImageView alloc] initWithFrame: CGRectMake(-26 ,8.5 ,26, 27)];
- aView.tag = EditTagUnchecked;
- [self.contentView addSubview: aView];
- self.myImageView = (UIImageView *)[self.contentView viewWithTag: EditTagUnchecked];
- [aView release];
- // in the didSelectRowAtIndexPath i have this implementation to toogle between the images when the user select that row:
- MyCell *cell = (MyCell *)[tableView cellForRowAtIndexPath:indexPath];
- if(cell.myImageView.tag == EditTagUnchecked)
- {
- cell.isSelected = YES;
- cell.myImageView.tag = EditTagChecked;
- cell.myImageView.image = [UIImage imageNamed: @"editChecked.png"];
- }
- else if(cell.myImageView.tag == EditTagChecked)
- {
- cell.isSelected = NO;
- cell.myImageView.tag = EditTagUnchecked;
- cell.myImageView.image = [UIImage imageNamed: @"editUnchecked.png"];
- }
- // My problem is when the table is in editing mode,if i select a few cells then scroll down some random cells
- // already have the image that should be there only when the row is selected.
- // in the cellForRowAtIndexPath i have this implementation:
- if(self.myTableView.editing)
- cell.myImageView.image = [UIImage imageNamed: @"editChecked.png"];
- // how can i fix this problem? i think the random images are there because of the reuse of cells instead of create new ones but i am not sure...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement