UITableViewCell content overlaps delete button when in editing mode in iOS7

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

    My solution is to move whole contentView to the left when Delete button showing:

    override func layoutSubviews() {
        super.layoutSubviews()
    
        if editingStyle == UITableViewCellEditingStyle.Delete {
            var rect = contentView.frame
            rect.origin.x = self.showingDeleteConfirmation ? -15 : 38
            contentView.frame = rect
        }
    }
    

提交回复
热议问题