简体   繁体   English

在滑动中增加删除子视图的大小以删除TableView单元格

[英]Increase size of delete subview in swipe to delete TableView cell

I am implementing a TableView menu which is accessed via a sliding view controller. 我正在实现一个TableView菜单,该菜单可通过滑动视图控制器访问。 The TableView is the "revealed" VC. TableView是“公开的” VC。

Users will need to delete items from the menu TableView, and I have implemented slide to delete, but my question is how can I increase the size of the delete SubView so that it is not masked by my sliding view controller? 用户将需要从TableView菜单中删除项目,并且我已经实现了幻灯片删除功能,但是我的问题是如何增加Delete SubView的大小,以便它不会被我的滑动视图控制器遮盖?

I have managed a hack-y solution by implementing the 我已经通过实施

titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath

method, and added trailing spaces in the literal so that the text in the delete SubView is not hidden, but there must be a more elegant way to address this. 方法,并在文字中添加尾随空格,以便不会隐藏delete SubView中的文本,但是必须有一种更优雅的方法来解决此问题。 Is there a way to increase the size? 有增加尺寸的方法吗?

Here's a screenshot of the interim solution in action: 这是运行中的临时解决方案的屏幕截图:

TableView与kludgy删除修复

Thanks! 谢谢!

You can try this code 您可以尝试此代码

- (void)layoutSubviews
{
    [super layoutSubviews];
    for(UIView *subview in self.subviews)
    {
        if([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"])
        {
            CGFrame oldFrame = subview.bonds.frame;
            subview.frame = CGRectMake(0, 0, 100, 50);
        }
    }
}

iPhone:How to change default delete button's frame in UITableViewCell iPhone:如何更改UITableViewCell中的默认删除按钮的框架

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM