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

廉价感情. 提交于 2019-12-07 06:27:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!