UIKeyboard

转自: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 UIWindow
mainView = [[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 layout
1 = numeric/punctuation layout
2 = phone keypad
3 = URL layout
4 = SMS (?) layout, shift disabled, num key goes to phone keypad
5 = black version of default layout
6 = spartan phone keypad
7 = black spartan (clean!)
8 = email keypad w/ space key
9 = 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];

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值