UITableViewCell从左向右滑动显示按钮

时间:2014-10-15 09:01:29

标签: ios uitableview nslayoutconstraint

UITableViewCell被刷right to left时,tableView:canEditRowAtIndexPath:被解雇,delete button显示在UITableViewCell的右侧。

我想在left to right - >用户滑动时执行相同的操作显示Delete and More按钮horizontally split

我正在关注符合我要求的this项目。我的疑问是如何将自定义按钮拆分为horizontally,即Delete button above More button

如果您下载并运行代码,那么在SWUtilityButtonView.m中您将看到以下代码:

- (void)setUtilityButtons:(NSArray *)utilityButtons{

if (!precedingView)
        {
            // First button; pin it to the left edge.
            [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[button]"
                                                                         options:0L
                                                                         metrics:nil
                                                                           views:NSDictionaryOfVariableBindings(button)]];
        }
        else
        {
            // Subsequent button; pin it to the right edge of the preceding one, with equal width.
            [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[precedingView][button(==precedingView)]"
                                                                         options:0L
                                                                         metrics:nil
                                                                           views:NSDictionaryOfVariableBindings(precedingView, button)]];
        }

        [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[button]|"
                                                                     options:0L
                                                                     metrics:nil
                                                                       views:NSDictionaryOfVariableBindings(button)]];
}

我应该对这些约束做出哪些修改,以使UIButtons一个高于其他约束?

0 个答案:

没有答案