0
我的代碼:UIKeyboard通知處理程序觸發3次
-(void)viewWillAppear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleKeyboard:) name:UIKeyboardWillChangeFrameNotification object:nil];
}
-(void)viewWillDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
-(void)handleKeyboard:(NSNotification*)notification {
NSLog(@"triggered");
}
參見:
日漸消失的處理程序觸發一次爲正常,但是當3次出現。這是一個iOS錯誤?
改爲使用'UIKeyboardWillShowNotification'名稱。有幫助。 – antonio 2015-04-01 09:14:28
@antonio試過了,同樣的問題。 – Allen 2015-04-01 09:17:10