我拿了文本字段出口集合并在那里绑定了六个文本字段。我想成为文本字段出口集合中下一个文本字段的FirstResponder。我从情节提要中给了文本字段标签 0 到 5。看,
主视图控制器:
class ViewController: UIViewController {
    @IBOutlet var txtSignUp: [UITextField]!
    var arrayPlaceHolder:NSArray!
    override func viewDidLoad() {
        super.viewDidLoad()
        arrayPlaceHolder = NSArray(array: ["1","2","3","4","5","6"])
        self.setTextFieldValue()
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    private func setTextFieldValue(){
        for txtField in txtSignUp{
            let tagTxt = txtField.tag
            txtField.attributedPlaceholder = NSAttributedString(string:arrayPlaceHolder[tagTxt] as! String, attributes:[NSForegroundColorAttributeName:UIColor.black])
            if(tagTxt != ((arrayPlaceHolder.count) - 1)){
                txtField.returnKeyType = .next
            }
            txtField.delegate = self
        }
    }
}
extension ViewController:UITextFieldDelegate{
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        textField.resignFirstResponder()
            for txt in txtSignUp{
                let nextTxt = (textField.tag + 1)
                if txt.tag == nextTxt {
                    txt.becomeFirstResponder()
                    break
                }
            }
            return true
        }
}
错误:
谁的视图不在窗口层次结构中!
解释:
在这段代码中,我不能成为成为成为FirstResponder 的下一个文本字段。
谁能帮我解决这个问题。
