我在带有 ios8.0 的 xcode6 中使用以下代码滑动 UITableViewCell。我的代码工作正常,但我需要为 UITableViewRowActions(更多、删除等)设置相等的宽度。这怎么可能?请帮助我。 .
-(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];
}
最佳答案
我知道它远非完美,但我为标题添加了空字符串
[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@" "
然后我用图片
block.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"block"]];
关于ios - iOS8.0中UITableViewRowAction如何管理等宽?(更多,删除等操作),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26361834/