Adam Adam - 1 year ago 100
iOS Question

How to hide keyboard while keeping cursor in swift

I am making a calculator and using my own keypad and i want there to be no keyboard that pops up when the textview is activated but i want the user to be able to move the cursor around. Any ideas are greatly appreciated.

Answer Source

you can change the inputView for the textfield to custom UIView. Something like below.

@IBOutlet weak var myTextField: UITextField!
let customView = UIView()

override func viewDidLoad() {

    myTextField.inputView = customView