Prevent Keyboard from appearing when tapping on UITextField

前端 未结 6 737
孤城傲影
孤城傲影 2021-01-19 22:11

I\'m using a UITextField to show results of a calculation but I don\'t want the keyboard to appear when the user taps on the UIText

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-19 22:40

    Swift 4.2, This works for me. put in viewDidLoad()

    //It will Hide Keyboard
    textField.inputView = UIView()
    //It will Hide Keyboard tool bar
    textField.inputAccessoryView = UIView()
    //It will Hide the cursor
    textField.tintColor = .white
    

提交回复
热议问题