iOS 8 UITableViewRowAction:向左滑动,图像?

我刚刚在iOS8上遇到了这个新的API。 我不能find任何解决scheme,如果有可能使用图像,而不是文本,并允许左右滑动? 这甚至有可能吗? 我发现的唯一的实现是这样的:

- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Button1" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){ // maybe show an action sheet with more options [self.tableView setEditing:NO]; }]; moreAction.backgroundColor = [UIColor blueColor]; UITableViewRowAction *moreAction2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Button2" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){ [self.tableView setEditing:NO]; }]; moreAction2.backgroundColor = [UIColor blueColor]; UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){ [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; }]; return @[deleteAction, moreAction, moreAction2]; } 

不,我不认为有可能有一个正确的刷卡(无论如何与一个UITableViewCell)。 但是,您可以通过使用colorWithPatternImage:来设置其背景颜色来使用button的图像。 button的宽度似乎是由标题的长度决定的,所以如果你想改变宽度(而没有任何可见的标题),可以使用一个包含尽可能多空格的标题。

在Swift中它将是:

 deleteAction.backgroundColor = UIColor(patternImage: UIImage(named:"sample")!)