Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“控制”;“制表键”;在iOS中使用外部键盘_Ios_Iphone_Swift_Xcode_Uitextfield - Fatal编程技术网

“控制”;“制表键”;在iOS中使用外部键盘

“控制”;“制表键”;在iOS中使用外部键盘,ios,iphone,swift,xcode,uitextfield,Ios,Iphone,Swift,Xcode,Uitextfield,我有一个有3-4个文本字段的屏幕。其中一个文本字段在尝试编辑时显示警报 但当我试图编辑其他文本字段并通过外部键盘按Tab键时,该警报将始终显示 我的代码 func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() return true } func textFieldShouldBeginEditing

我有一个有3-4个文本字段的屏幕。其中一个文本字段在尝试编辑时显示警报

但当我试图编辑其他文本字段并通过外部键盘按Tab键时,该警报将始终显示

我的代码

 func textFieldShouldReturn(_ textField: UITextField) -> Bool {

        textField.resignFirstResponder()
        return true
    }

    func textFieldShouldBeginEditing (_ textField: UITextField) -> Bool {

        if  textField == txt_a {

            let alertController = UIAlertController(title: "Custom TextField", message: "Do your custom work here", preferredStyle: .alert)
            alertController.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil))
            self.present(alertController, animated: true, completion: nil)
            //self.present(alertController, animated: true, completion: nil)

                return false
            }
        return true
    }
那么,我如何控制/检测**制表键

谢谢,