사용자 지정 셀에 2 UITextfield
이 있습니다. 이제 다른 뷰에서 푸시 할 때이 첫 번째 텍스트 필드에 중점을두고 싶습니다. 여기 사용자 지정 셀의 포커스 UITextfield
cellForRowAt
위임에 내 코드하지만이 작동하지 않습니다
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let userCell = tableView.dequeueReusableCell(withIdentifier: "InputUserInfoForm") as! InputUserInfoForm
userCell.selectionStyle = .none
userCell.fistnameTextField.autocorrectionType = .no
userCell.lastnameTextField.autocorrectionType = .no
// Firstname textfield
userCell.fistnameTextField.tag = RegisterForm.Firstname.rawValue
userCell.firstnameLabel.text = "FirstnameTitle".localized()
userCell.firstnameLabel.becomeFirstResponder()
// Lastname textfield
userCell.lastnameTextField.tag = RegisterForm.Lastname.rawValue
userCell.lastnameLabel.text = "LastnameTitle".localized()
return userCell
}
왜이 코드를'cellForRowAt'에 넣고 있습니까? 'viewDidAppear'에 더 적합합니다. – toddg