监听键盘高度变化
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasChange:) name:UIKeyboardDidChangeFrameNotification object:nil];
- (void)keyboardWasChange:(NSNotification *)aNotification {
NSLog(@"Keyboard change");
NSDictionary *info = [aNotification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
if (kbSize.height == 216) {
NSLog(@"english");
[UIView animateWithDuration:0.3f animations:^{
CGRect curFrame=self.view.frame;
curFrame.origin.y = viewFrameY -216.0;
self.view.frame=curFrame;
}];
}
else if(kbSize.height == 252){
[UIView animateWithDuration:0.3f animations:^{
CGRect curFrame=self.view.frame;
curFrame.origin.y = viewFrameY -252.0;
self.view.frame=curFrame;
}];
NSLog(@"中文");
}
}