UITableViewCell content overlaps delete button when in editing mode in iOS7

前端 未结 11 1076
长情又很酷
长情又很酷 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:01

    The problem is that in edit mode the cell's contentView changes in size. So either you have to override layoutSubviews in your cell and support the different frame sizes

    - (void) layoutSubviews
    {
        [super layoutSubviews];
        CGRect contentFrame = self.contentView.frame;
        // adjust to the contentView frame
        ...
    }
    

    or you take the bait and switch to autolayout.

    First I thought setting contentView.clipsToBounds to YES could be an ugly workaround but that does not seem to work.

提交回复
热议问题