The resulting code ends up with if you swipe a table entry, it shifts right just like for the table level edit. Irritating.
- ///////////////////////////////////////////////////
- //
- ///////////////////////////////////////////////////
- - (void) layoutSubviews
- {
- CGRect frame;
- CGRect cellFrame = self.frame;
- CGRect contentFrame = self.contentView.frame;
- UITableView* table = (UITableView*) [self superview];
- BOOL tableEditting = table.editing;
- BOOL isedit = self.editing;
- BOOL cellEditting = self.showingDeleteConfirmation;
- // NSInteger indentLevel = self.indentationLevel;
- // CGFloat indentWidth = self.indentationWidth;
- CGFloat leftOffset = 0;
- if (tableEditting)
- {
- leftOffset = 35;
- }
- CGFloat rightOffset = 0;
- if (cellEditting)
- {
- rightOffset = 80;
- }
- frame = topImage.frame;
- frame = bottomImage.frame;
- frame.origin.x = 0;
- frame.origin.y = cellFrame.size.height - 5;
- bottomImage.frame = frame;
- if (hasAvatar)
- {
- frame.origin.x = frame.origin.y = 6;
- frame.size.height = frame.size.width = 45;
- cellAvatarView.frame = frame;
- }
- else
- {
- cellAvatarView.frame = CGRectZero;
- }
- //
- frame.origin.y = 5;
- frame.size.height = cellFrame.size.height-10;
- if (hasAvatar)
- {
- frame.origin.x = 57;
- frame.size.width = cellFrame.size.width - (57 + leftOffset + rightOffset);
- }
- else
- {
- frame.origin.x = 6;
- frame.size.width = cellFrame.size.width - (6 + leftOffset + rightOffset);
- }
- cellLabelView.frame = frame;
- frame.origin.x = leftOffset;
- frame.origin.y = 0;
- frame.size.height = cellFrame.size.height;
- frame.size.width = cellFrame.size.width - (leftOffset + rightOffset);
- self.contentView.frame = frame;
- // }//end if labelview
- }
Addendum: My answer, which makes me feel dirty and bad about myself, was to subclass UITableView and add a flag that could be accessed in the cell layoutSubviews that I could set when I entered/exited table edit mode. My first impulse was to override setEditing:animated but it turns out that it gets called when the swipe is detected. Which makes sense in light of things. Not happy about how that works though.
No comments:
Post a Comment