监听键盘高度变化 [[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(@"中文"); } }
ios 文本框随着键盘高度变化而变化
猜你喜欢
转载自longquan.iteye.com/blog/1915054
今日推荐
周排行