开发者

Prevent default keyboard from showing when UITextField is pressed

开发者 https://www.devze.com 2023-01-05 21:32 出处:网络
Is there a way to make a custom keyboard to pop up when a user presses on a UITextField.开发者_JAVA百科 I have a view with a custom keypad on it and I want that to come up when the user presses on the

Is there a way to make a custom keyboard to pop up when a user presses on a UITextField.开发者_JAVA百科 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.


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.


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


not sure I understand the question? the keyboard type can be assigned to the UITextField so If you want a different one then specify it when initializing the object

UITextField * textFld = [[UITextField alloc] init];
textFld.keyboardType = UIKeyboardTypeNumbersAndPunctuation;

http://developer.apple.com/iphone/library/documentation/uikit/reference/UITextInputTraits_Protocol/Reference/UITextInputTraits.html#//apple_ref/doc/c_ref/UIKeyboardType

0

精彩评论

暂无评论...
验证码 换一张
取 消