0

我知道当在键盘上按下向下箭头键时,我们可以获得键盘隐藏通知,但问题是,当我们旋转设备和键盘隐藏时,我们也会收到键盘隐藏通知,现在如何区分由于按下键而隐藏的键盘不是因为旋转。在此处输入图像描述

4

2 回答 2

3

在你的 AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
      [[NSNotificationCenter defaultCenter] 
      addObserver:self selector:@selector(keyboardWillHide) 
      name:UIKeyboardWillHideNotification object:nil];
      return YES;
}


-(void) keyboardWillHide {
  NSLog(@"Bye");
}
于 2013-03-26T04:39:23.117 回答
0

当我们点击of时,会自动调用以下Delegate方法。textfieldreturn or arrow buttonkeyboard

- (BOOL)textFieldShouldReturn:(UITextField *)textField
于 2013-03-26T04:37:30.477 回答