我不想拨打电话号码。我只是想以编程方式打开手机键盘。
我该怎么做?
答案 0 :(得分:0)
我认为您可以添加UITextField并将其隐藏,然后调用becomeFirstResponder:
var textField : UITextField //Create and set hidden to true
textField.keyboardType = UIKeyboardType.PhonePad //keyboardType
textField.hidden = true
//To Fire keyboard
textField.becomeFirstResponder()
答案 1 :(得分:0)
更新@Hossam Ghareb的回答
var textField : UITextField = UITextField(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) //Create and set hidden to true
textField.keyboardType = UIKeyboardType.PhonePad //keyboardType
textField.hidden = true
//To Fire keyboard
textField.becomeFirstResponder()
//Add to your view
self.view.addSubview(textField)