【发布时间】:2012-12-25 13:45:59
【问题描述】:
我在主视图控制器中将以下代码添加到viewWillAppear:animated。
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showKeyboard:) name:UIKeyboardWillShowNotification object:nil];
而且,我在同一个类中实现了这个方法,
- (void)showKeyboard:(NSNotification *)notification
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Keyboard will appear." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
主视图控制器有一个 UITextField 对象。
在 iPad2 (iOS 5.0) 中,当它获得焦点时会出现一个警报视图。 但是,在 iPad mini (iOS 6.0) 中,除了软键盘之外什么都没有出现。
我想让 iPad mini 的行为与 iPad2 相同。
谢谢,
【问题讨论】:
-
是 "viewWillAppeaer:animated" 你在代码中是怎么拼写的?
-
哦...,这只是一个拼写错误。谢谢。
标签: ios nsnotificationcenter ipad-mini