在textView中输入时避免键盘的遮挡(2)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-17 14:38 点击:次
[super viewWillAppear:YES];
}
//监听事件
- (void)handleKeyboardDidShow:(NSNotification*)paramNotification
{
//获取键盘高度
NSValue *keyboardRectAsObject=[[paramNotification userInfo]objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect;
[keyboardRectAsObject getValue:&keyboardRect];
self.textView.contentInset=UIEdgeInsetsMake(0, 0,keyboardRect.size.height, 0);
}
- (void)handleKeyboardDidHidden
{
self.textView.contentInset=UIEdgeInsetsZero;
}
- (void)viewDidDisappear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
相关新闻>>
- 发表评论
-
- 最新评论 更多>>