ios - 在 UITableViewRowAction 按钮中管理 Equall 宽度?

标签 ios iphone ipad ios8

我有一个 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/

相关文章:

ios - UIPageControl UIControlEventValueChanged - 我怎么知道以前的值?

iphone - xcode iOS 获取所有本地化的列表

iphone - 如何允许 iPhone 用户 "Move and Scale"已选择的照片

ios - UIPopoverController 奇怪的调整大小行为

iphone - UIImagepicker 不显示在 iPad Storyboard中

objective-c - 为什么多线程在此实现中不起作用?

ios - 在 iOS 模拟器中测试蓝牙

iphone - PhoneGap iPad 启动屏幕不适合

ios - 等效于 Interface Builder 中 UIButton 的动态类型 "automatically adjusts font"设置?

iphone - UIBarButtonItem 偏移量