适用于SDK 4的自定义iPhone KeyBoard(iOS4操作系统)

旧SDK解决方案:

- (void)modifyKeyboard:(NSNotification *)notification { UIView *firstResponder = [[[UIApplication sharedApplication] keyWindow] performSelector:@selector(firstResponder)]; for (UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows]) for (UIView *keyboard in [keyboardWindow subviews]) if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES) { MyFancyKeyboardView *customKeyboard = [[MyFancyKeyboardView alloc] initWithFrame: CGRectMake(0, 0, keyboard.frame.size.width, keyboard.frame.size.height); [keyboard addSubview: customKeyboard]; [customKeyboard release]; } } 

按照上面的方法,我现在发现iOS4是不同的。 不起作用。 我确信这是由于命名子视图(或排序)的差异。 对于iphone SDK 4,有谁知道如何解决同样的问题?

你可以看一下这篇文章: http : //www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-key

它解决了该问题,适用于所有版本的SDK

是。 iOS 4支持自定义输入视图 – 您可以通过设置响应者的inputView属性,将您自己的MyFancyKeyboardView交换为任何UIResponderinheritance类(例如UITextFieldUITextView )的键盘。

4.1 SDK现在有一个你正在尝试做的UIKeyboardTypeDecimalPad,对吧?

对于ios 5,它似乎不起作用。 但是当我改变这样的代码时:

UIKeyboard更改为UIPeripheralHostView

有用。 我希望它对其他开发人员有用。