Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent default keyboard from showing when UITextField is pressed

Is there a way to make a custom keyboard to pop up when a user presses on a UITextField. I have a view with a custom keypad on it and I want that to come up when the user presses on the UITextField instead of the default apple keyboard.

like image 656
Omar Avatar asked Jul 04 '10 19:07

Omar


People also ask

How do I turn off TextField keyboard?

disable keyboard for Textfield coderanch.comsetEditable( false ); Sets the specified boolean to indicate whether or not this TextComponent should be editable. A PropertyChange event ("editable") is fired when the state is changed. (2) yourTextField. setEnabled( false ); Sets whether or not this component is enabled.

How to dismiss keyboard in Swift Ui?

If you're supporting only iOS 15 and later, you can activate and dismiss the keyboard for a text field by focusing and unfocusing it. In its simplest form, this is done using the @FocusState property wrapper and the focusable() modifier – the first stores a Boolean that tracks whether the second is currently focused.

How to disable keyboard in TextField SwiftUI?

if you already have a TextField setup, you can add . disabled(true) , this will stop the keyboard from showing up.


2 Answers

Since iOS 3.2 there's a property for exactly that, called inputView.

just go like this: [myTextField setInputView:myInputView] - where myInputView is obviously your custom input view. Then the system will pop up your view instead of the predefined keyboards.

like image 173
Toastor Avatar answered Sep 21 '22 07:09

Toastor


You may set delegate in your UITextField and return NO in textFieldShouldBeginEditing:.

like image 5
ivanzoid Avatar answered Sep 21 '22 07:09

ivanzoid