0
我想抓住RxSwift,我需要验证窗体,我做了没有tableView的简单验证,但现在我的文本输入字段在集合视图,我想观察变化文本输入,文本框现在在可重复使用的电池,我不知道如何从中添加观测并获得流RxSwift与CollectionView/TableView输入/ textfields
基本上我想要2路我的数据我的形式,其中输入是动态的结合,如果这能帮助
这里是我cellForItemAt功能的代码
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: RegisterCell.identifier, for: indexPath) as! RegisterCell
var registerField = dataSource[indexPath.item]
registerField.indexPath = indexPath
registerField.text = viewModel.getText(indexPath: indexPath)
let txt = cell.txtfield as UITextField
txt.delegate = self
cell.configureCell(registerField)
return cell
}
和配置细胞
func configureCell(_ fieldData: RegisterFields) {
txtfield.placeholder = fieldData.placeholderText
txtfield.isSecureTextEntry = fieldData.isSecureEntry
txtfield.text = fieldData.text
txtfield.tag = fieldData.indexPath.item
imgIcon.image = fieldData.image
imgDropDown.isHidden = !fieldData.isDropDown
}
我想使用的Rx对用户输入的,而不是委托模式,如下面的行
txt.delegate =自
下面做是我的形象屏幕
我已经添加了所有的细节了解的问题,请在投票前阅读问题,谢谢 –
您是否将表数据绑定到tableview或者您是否使用普通的tableview代表?或RxDataSource? –
我使用普通的tableview代理,单元格中有一个文本框,我想在该文本框中监听用户输入 –