问题
I am using following code for swipe UITableViewCell in xcode6 with ios8.0.My code is working fine,but i need to set equal width for UITableViewRowActions (more,Delete,etc).How is that possible?Please help me..
-(NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@“More” handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
}];
UITableViewRowAction *flagAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@“Flag” handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
}];
UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
// [self.objects removeObjectAtIndex:indexPath.row];
}];
return @[deleteAction,flagAction,moreAction];
}
回答1:
I know that It's way far from perfect but I added empty string for the title
[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@" "
and then I used images
block.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"block"]];
来源:https://stackoverflow.com/questions/26361834/how-to-manage-equal-width-for-uitableviewrowaction-in-ios8-0more-delete-etc-ac