Created
October 16, 2013 05:08
-
-
Save JigsChanchiya/7002903 to your computer and use it in GitHub Desktop.
In uitableview performs the swipe action with custom delete button.
This file contains 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
/* | |
This method will be called when user performs the swipe action | |
Just Place this in your CustomCell | |
*/ | |
- (void)willTransitionToState:(UITableViewCellStateMask)state | |
{ | |
[super willTransitionToState:state]; | |
if ((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask) | |
{ | |
for (UIView *subview in self.subviews) | |
{ | |
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"]) | |
{ | |
UIImageView *deleteBtn = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 64, 33)]; | |
[deleteBtn setImage:[UIImage imageNamed:@"customDelete.png"]]; | |
[[subview.subviews objectAtIndex:0] addSubview:deleteBtn]; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment