UIKeyboard

来源:互联网 发布:js除法取整 编辑:程序博客网 时间:2024/06/04 18:34

转自:http://www.cocoadev.com/index.pl?UIKeyboard


Part of the iPhone UIKit framework. Subclass of UIView.

+ (void)initImplementationNow;

Must be called before initWithFrame?

- (id)initWithFrame:(CGRect)frame;

    [UIKeyboard initImplementationNow];  UIKeyboard *keyboard = [[UIKeyboard alloc] initWithFrame: CGRectMake(0.0f, 245.0f,                                                              320.0f, 480.0f - 245.f)];//Call up your keyboard into your mainView created as a UIWindowmainView = [[UIView alloc] initWithFrame: rect];

enum values for setDefaultReturnKeyType:

0 = Return (gray background)1 = Go (blue background)2 = Google (blue background)3 = Join (blue background)4 = Next (gray background)5 = Route (blue background)6 = Search (blue background)7 = Send (blue background)8 = Yahoo! (blue background)

To change the keyboard layout, use one of the below enums for setPreferredKeyboardType, followed with a call to showPreferredLayout:

0 = default QWERTY layout1 = numeric/punctuation layout2 = phone keypad3 = URL layout4 = SMS (?) layout, shift disabled, num key goes to phone keypad5 = black version of default layout6 = spartan phone keypad7 = black spartan (clean!)8 = email keypad w/ space key9 = email keypad w/ @ instead of space

As an aside, if you're using UIAlert?, be sure to set popupAlertAnimated:NO otherwise your showPreferredLayout will be overridden with the default layout. For example:

      [myAlert popupAlertAnimated:NO];      [[myAlert keyboard] setPreferredKeyboardType: 1];      [[myAlert keyboard] showPreferredLayout];

原创粉丝点击