首页 > 其他 > 详细

监听系统键盘的方法

时间:2015-03-11 22:55:16      阅读:317      评论:0      收藏:0      [点我收藏+]

[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(KeyBoardWillChange:) name:UIKeyboardWillChangeFrameNotification object:nil];

//监听通知的方法

-(void)KeyBoardWillChange:(NSNotification *)notification{

    CGFloat height = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey]CGRectValue].origin.y;

    [UIView animateWithDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue] animations:^{

//自定义输入框 _inputView

        _inputView.frame=CGRectMake(0, height-49, SCREEN_WIDTH, 49);

        

    }];

}

监听系统键盘的方法

原文:http://www.cnblogs.com/ysh-LOVE-hmx-5201314/p/4331045.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!