我在我的UItableviewCell上有UITextField,当我点击键盘上的done按钮时,我的单元格视图将从Superview中删除
override func layoutSubviews() {
super.layoutSubviews()
self.selectionStyle = .none
line.backgroundColor = .custom_gray()
line.snp.makeConstraints { (cons) in
cons.bottom.left.right.equalTo(phone).inset(0)
cons.height.equalTo(0.5)
}
stack.snp.makeConstraints { (cons) in
cons.left.right.equalTo(self).inset(25)
cons.centerY.equalTo(self)
cons.height.equalTo(230)
cons.bottom.equalTo(self).inset(15)
}
stack.dropShadow()
stack.layoutIfNeeded()
}发布于 2019-08-12 14:38:17
我通过将我的视图添加到TableviewCell内容视图来解决这个问题
self.contentView.addSubview(stack)
phone.delegate = self
password.delegate = self
stack.snp.makeConstraints { (cons) in
cons.left.right.equalTo(self.contentView).inset(25)
cons.centerY.equalTo(self.contentView)
cons.height.equalTo(230)
cons.bottom.equalTo(self.contentView).inset(15)
}
self.contentView.backgroundColor = .white我从tableviewHeaderContent返回这个视图
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let head = tableView.dequeueReusableCell(withIdentifier: headerid) as! ProfileLoginTableViewCell
return head.contentView
}https://stackoverflow.com/questions/57455420
复制相似问题