键盘类型用于UITextView

use*_*241 2 iphone objective-c uitextview ios uikeyboardtype

我想知道如何获得uitextview的键盘类型.我可以使用textfield.keyboardtype获取uitextfield的键盘类型,但它似乎不适用于uitextview.请帮我解决这个问题.

提前致谢.

iOS*_*est 8

试试这个

UITextView *txvw = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 24, 20)];
txvw.keyboardType =UIKeyboardTypeURL;
Run Code Online (Sandbox Code Playgroud)

和备用键盘类型

UIKeyboardTypeDefault,                // Default type for the current input method.
UIKeyboardTypeASCIICapable,           // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active
UIKeyboardTypeNumbersAndPunctuation,  // Numbers and assorted punctuation.
UIKeyboardTypeURL,                    // A type optimized for URL entry (shows . / .com prominently).
UIKeyboardTypeNumberPad,              // A number pad (0-9). Suitable for PIN entry.
UIKeyboardTypePhonePad,               // A phone pad (1-9, *, 0, #, with letters under the numbers).
UIKeyboardTypeNamePhonePad,           // A type optimized for entering a person's name or phone number.
UIKeyboardTypeEmailAddress,           // A type optimized for multiple email address entry (shows space @ . prominently).
Run Code Online (Sandbox Code Playgroud)