UITableViewCell content overlaps delete button when in editing mode in iOS7

前端 未结 11 1074
长情又很酷
长情又很酷 2020-12-15 07:50

I am creating a UITableView with custom UITableViewCells. iOS 7\'s new delete button is causing some problems with the layout of my cell.

I

11条回答
  •  别那么骄傲
    2020-12-15 08:12

    And if any one want to adjust the Delete Button Size, Use the following Code

    - (void)layoutSubviews {
    
        [super layoutSubviews];
    
        for (UIView *subview in self.subviews) {
    
            for (UIView *subview2 in subview.subviews) {
    
                if ([NSStringFromClass([subview2 class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"]) { // move delete confirmation view
    
                    CGRect rect = subview2.frame;
                    rect.size.height = 47; //adjusting the view height
                    subview2.frame = rect;
    
                    for (UIButton *btn in [subview2 subviews]) {
    
                        if ([NSStringFromClass([btn class]) isEqualToString:@"UITableViewCellDeleteConfirmationButton"]) { // adjusting the Button height
                            rect = btn.frame;
                            rect.size.height = CGRectGetHeight(subview2.frame);
                            btn.frame = rect;
    
                            break;
                        }
                    }
    
                    [subview bringSubviewToFront:subview2];
    
                }
            }
        }
    }
    

提交回复
热议问题