简体   繁体   中英

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. The TableView is the "revealed" 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?

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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