Prevent Keyboard from appearing when tapping on UITextField

前端 未结 6 735
孤城傲影
孤城傲影 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条回答
  •  后悔当初
    2021-01-19 22:40

    Its quite simple to do with UITextField. Use this code in viewDidLoad()

    self.txtresult.inputView = UIView()
      self.txtresult.inputAccessoryView = UIView()
    

提交回复
热议问题