Skip to content

Instantly share code, notes, and snippets.

@JigsChanchiya
Created October 16, 2013 05:08
Show Gist options
  • Save JigsChanchiya/7002903 to your computer and use it in GitHub Desktop.
Save JigsChanchiya/7002903 to your computer and use it in GitHub Desktop.
In uitableview performs the swipe action with custom delete button.
/*
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