2

I created a custom input view for the App I'm currently working on, I can assign this keyboard to a textField by doing:

textField.inputView = myCustomKeyboard as! UIView

Now I just want to switch out all inputViews with my custom inputView, is there a simpler way to do this without having to set the inputView on all the textFields separately in my app?

Steven B.
  • 1,429
  • 2
  • 19
  • 38
  • 1
    You can subclass UITextField and set your custom view in initializer. Or you can just write extension with method that is assigning your custom keyboard. And than call this method for every textfield. – NSDmitry Jan 03 '17 at 11:42

1 Answers1

5
[[UITextField appearance] setInputView:customeView];

or swift:

UITextField.appearance().inputView = customeView

Please create custom view and add this line into app delegate did finish launching option

Steven B.
  • 1,429
  • 2
  • 19
  • 38
Matloob Hasnain
  • 1,025
  • 6
  • 21