Ios 管理UITableViewRowAction按钮中的相等宽度?
我有一个IPHone应用程序,在其中我尝试使用UITableViewRowAction和编辑、复制和删除选项,它一直运行良好。问题是我想使所有按钮的宽度相等,标题带下划线。我就是这样做的Ios 管理UITableViewRowAction按钮中的相等宽度?,ios,iphone,ipad,ios8,Ios,Iphone,Ipad,Ios8,我有一个IPHone应用程序,在其中我尝试使用UITableViewRowAction和编辑、复制和删除选项,它一直运行良好。问题是我想使所有按钮的宽度相等,标题带下划线。我就是这样做的 `UITableViewRowAction *EditAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Edit” handler:^(UITableViewRowAction *a
`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]];`
有人能帮我吗?下面是UITableViewRowAction的UIKit界面。看起来没有尺码。你可以自己做,但这很耗时: 我所做的只是在标题中添加空格,直到按钮看起来大小相同(即@“\uuuuuuuuuuuuuuuuuuuuuuuuuuuuu”)。
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
NS\u类\u可用\u IOS(8\u 0)@interface UITableViewRowAction:NSObject
+(instancetype)rowActionWithStyle:(UITableViewRowActionStyle)样式标题:(NSString*)标题处理程序:(void(^)(UITableViewRowAction*action,NSIndexPath*indexPath))处理程序;
@属性(非原子,只读)UITableViewRowActionStyle样式;
@属性(非原子,副本)NSString*标题;
@属性(非原子,复制)UIColor*backgroundColor;//默认背景色取决于样式
@属性(非原子,复制)UIVisualEffect*背景效果;
@结束
下面是UIKit中用于UITableViewRowAction的界面。看起来没有尺码。你可以自己做,但这很耗时:
我所做的只是在标题中添加空格,直到按钮看起来大小相同(即@“\uuuuuuuuuuuuuuuuuuuuuuuuuuuuu”)。
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
NS\u类\u可用\u IOS(8\u 0)@interface UITableViewRowAction:NSObject
+(instancetype)rowActionWithStyle:(UITableViewRowActionStyle)样式标题:(NSString*)标题处理程序:(void(^)(UITableViewRowAction*action,NSIndexPath*indexPath))处理程序;
@属性(非原子,只读)UITableViewRowActionStyle样式;
@属性(非原子,副本)NSString*标题;
@属性(非原子,复制)UIColor*backgroundColor;//默认背景色取决于样式
@属性(非原子,复制)UIVisualEffect*背景效果;
@结束
我知道这很奇怪,但目前还没有设置行操作按钮高度或宽度的属性。
按钮的高度和行的高度相同。
按钮的宽度基于标题的文本。
唯一的解决方法是在标题的两侧添加空白:
UITableViewRowAction(style: .Destructive, title: " Delete ")
我知道这很奇怪,但目前还没有设置行操作按钮高度或宽度的属性。
按钮的高度和行的高度相同。
按钮的宽度基于标题的文本。
唯一的解决方法是在标题的两侧添加空白:
UITableViewRowAction(style: .Destructive, title: " Delete ")