我有一个 IPHone 应用程序,我在其中尝试将 UITableViewRowAction 与编辑、复制和删除选项一起使用,它一直运行良好。问题是我想让所有按钮的宽度都相等,并且标题带有下划线.我是这样做的
`UITableViewRowAction *EditAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Edit” handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
indextodelete=(int)indexPath.section;
// maybe show an action sheet with more options
[self.mTableView setEditing:NO];
}];
EditAction.backgroundColor = [UIColor GreenColor]];`
谁能帮帮我?
最佳答案
下面是 UIKit 中用于 UITableViewRowAction 的接口(interface)。好像没有尺码。您可以自己全部完成,但这很耗时:http://www.raywenderlich.com/62435/make-swipeable-table-view-cell-actions-without-going-nuts-scroll-views .
我所做的只是在标题中添加空格,直到按钮看起来大小相同(即@"___Delete_____")。
NS_CLASS_AVAILABLE_IOS(8_0) @interface UITableViewRowAction : NSObject <NSCopying>
+ (instancetype)rowActionWithStyle:(UITableViewRowActionStyle)style title:(NSString *)title handler:(void (^)(UITableViewRowAction *action, NSIndexPath *indexPath))handler;
@property (nonatomic, readonly) UITableViewRowActionStyle style;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) UIColor *backgroundColor; // default background color is dependent on style
@property (nonatomic, copy) UIVisualEffect* backgroundEffect;
@end
关于ios - 在 UITableViewRowAction 按钮中管理 Equall 宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26403302/