Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage equal width for UITableViewRowAction in iOS8.0?(More,Delete,etc actions)

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];

 }
like image 834
IKKA Avatar asked Nov 11 '22 00:11

IKKA


1 Answers

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"]];

enter image description here

like image 59
johnny Avatar answered Nov 14 '22 22:11

johnny