Swift 3:TPKeyboardAvoidingScrollView无法在UITableViewCell中的一个UITextField上正常工作
问题描述:
我遇到这个问题,我有三个单元,全部由相同的函数创建,但由于某种原因,第三个单元有滚动(姓氏单元格) 。Swift 3:TPKeyboardAvoidingScrollView无法在UITableViewCell中的一个UITextField上正常工作
我使用TPKeyboardAvoidingTableView
,这通常想象的最伟大的事情,但由于某些原因,它不喜欢这个小区。以下是代码:
guard let cell = tableView.dequeueReusableCell(withIdentifier: SignUp_Constants.DetailsCellIdentifier, for: indexPath) as? DetailsCell else { return UITableViewCell() }
cell.isUserInteractionEnabled = true
cell.detailsInputTextField.removeTarget(nil, action: nil, for: .allEvents)
cell.detailsInputTextField.addTarget(cell, action: #selector(DetailsCell.textFieldDidChange(_:)), for: .editingChanged)
cell.detailsInputTextField.autocapitalizationType = .none
cell.detailsInputTextField.spellCheckingType = .default
cell.detailsInputTextField.isSecureTextEntry = false
cell.detailsInputTextField.isUserInteractionEnabled = true
cell.detailsInputTextField.keyboardType = .default
cell.delegate = self
var title = SignUp_Constants.getTitle(forCellType: currentSectionView, atRow: indexPath.row)
cell.setTextFieldText(toValue: signUpDictionary[title] as? String ?? "")
cell.setTitleLabel(to: title)
return cell
在ENTIRE项目中使用相同代码创建的每个其他单元格都能正常工作。
任何帮助和提前感谢!
答
经过很多麻烦和敲打我的头在桌子上,我决定扔在tableView.scrollToRow(row: x, atIndexPath: indexPath)
当用户点击文本框,错误消失了!我已经多次使用这个吊舱,并且从来没有必须使用它的功能,所以如果任何人有任何其他解决方案,听到他们会很高兴!