鉴于Apple's tutorial中的详细信息视图,如何使详细视图中的单元格可编辑?不仅要添加或删除单元格,还要修改单元格值中的文本(单元格中的右侧标签)?
答案 0 :(得分:1)
然后,当用户更改它们时(通过委托设置),您还必须连接viewController以获取它们,并设置模型以接受委托实现中的数据。
祝你好运。答案 1 :(得分:0)
有一个容器:https://github.com/fulldecent/FDTextFieldTableViewCell
以下是相关代码:
self.detailTextLabel?.isHidden = true
self.contentView.viewWithTag(3)?.removeFromSuperview()
self.textField.tag = 3
self.textField.translatesAutoresizingMaskIntoConstraints = false
self.contentView.addSubview(self.textField)
self.addConstraint(NSLayoutConstraint(item: self.textField, attribute: .leading, relatedBy: .equal, toItem: self.contentView, attribute: .leading, multiplier: 1, constant: 50))
self.addConstraint(NSLayoutConstraint(item: self.textField, attribute: .top, relatedBy: .equal, toItem: self.contentView, attribute: .top, multiplier: 1, constant: 8))
self.addConstraint(NSLayoutConstraint(item: self.textField, attribute: .bottom, relatedBy: .equal, toItem: self.contentView, attribute: .bottom, multiplier: 1, constant: -8))
self.addConstraint(NSLayoutConstraint(item: self.textField, attribute: .trailing, relatedBy: .equal, toItem: self.contentView, attribute: .trailing, multiplier: 1, constant: -16))
self.textField.textAlignment = .right