-
-
Save cute/8c08df76fdeae2d1146bc67e52a8b205 to your computer and use it in GitHub Desktop.
gist 7: iOS - Customize UITableViewCell delete/move overlay views while editing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)layoutSubviews{ | |
[super layoutSubviews]; | |
[UIView beginAnimations:nil context:NULL]; | |
[UIView setAnimationBeginsFromCurrentState:YES]; | |
[UIView setAnimationDuration:0.0f]; | |
for (UIView *subview in self.subviews) { | |
if([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"]) { | |
// do magic here | |
... | |
}else if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellEditControl"]) { | |
// do magic here | |
... | |
}else if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellReorderControl"]) { | |
// do magic here | |
// example - use the full cell area as touching ground for the drag & drop | |
// we'll also remove the move icon | |
// change the drag & drop touch area frame | |
CGRect newFrame = self.frame; | |
newFrame.origin.x = 0.0; | |
newFrame.origin.y = 0.0; | |
subview.frame = newFrame; | |
// search for the move icon | |
for(UIView * subview2 in subview.subviews){ | |
if ([subview2 isKindOfClass: [UIImageView class]]) { | |
// remove the icon | |
[subview2 removeFromSuperview]; | |
} | |
} | |
} | |
} | |
[UIView commitAnimations]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment