我想编辑我的桌子的UITableViewRowAction。我的单元格有圆形的边缘和边框,我想编辑RowAction的样式来匹配我的单元格的样式。
我知道目前只有backgroundColor,标题和样式(默认,破坏性,正常.)可以更改(链接)。不过,我觉得这是有点太局限了?也许我可以用子类UITableViewRowAction来创建我自己的外观和感觉?如有任何建议,将不胜感激。
不幸的是,我不能发布一个示例图像,因为我还没有10个代表(哈哈)。然而,我认为这个问题很简单,可以在没有视觉表现的情况下理解。
发布于 2014-11-14 05:16:03
正如您所说的,您可以在操作中更改的唯一事情是:
为了改变UITableViewRowAction的样式,可能的解决方案是使用“模式图像”添加图像。
这是this.And的解决方案--我不是说这是确切的解决方案,因为现在我们无法访问“UITableViewRowAction”的所有属性
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"test" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
// show UIActionSheet
}];
float wwidth =[moreAction.title sizeWithAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:15.0]}].width;
wwidth = wwidth+<55 change this value for exact width>;
moreAction.backgroundColor = [[UIColor alloc] initWithPatternImage:[self imageWithImage:[UIImage imageNamed:@"temp.jpg"] scaledToSize:CGSizeMake(wwidth, tableView.rowHeight)]];
UITableViewRowAction *flagAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Flag" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
// flag the row
}];
flagAction.backgroundColor = [UIColor yellowColor];
return @[moreAction, flagAction];
}注意:使用高分辨率图像,使其适用于
iPhone 6 Plus 736x414 points 5.5"
iPhone 6 667x375 points 4.7"
iPhone 5 568x320 points 4.0"
iPhone 4 480x320 points 3.5"关于此链接http://pablin.org/的有用文章
发布于 2015-06-15 08:54:23
您可以尝试使用以下方法:自定义UITableViewCell --支持单元格拖动手势以显示按钮或其他视图的自定义菜单的自定义UITableViewCell。它支持:
https://stackoverflow.com/questions/26907285
复制相似问题