ios - iOS8.0中UITableViewRowAction如何管理等宽?(更多,删除等操作)

标签 ios objective-c iphone uitableview xcode6

我在带有 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"]];

enter image description here

关于ios - iOS8.0中UITableViewRowAction如何管理等宽?(更多,删除等操作),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26361834/

相关文章:

ios - 如何通过容器 View Controller 判断使用了哪些单元格?

iphone - 如何在服务器上动态上传图片?

ios - 为什么 Modernizr 为 iOS 设备设置拖放类

iphone - 将对象设置为 nil 与在 dealloc 中向其发送释放消息有什么区别

objective-c - 未导入 Objective C 类别但仍在运行代码

iphone - 音频队列 - 没有匹配函数来调用 'AudioSessionInitialize'

iphone - 无法刷新i​​Phone sqlite3数据库

iphone - 越狱 iOS 的命令行程序在 iPad 中死亡,但在 iPhone 3G 中没有

iOS Storyboard - 自动布局不会调整 subview 的大小和位置

objective-c - 为什么我不能在我的 iOS 项目的类中导入我的协议(protocol)?