码迷,mamicode.com
首页 > 其他好文 > 详细

监听系统键盘的方法

时间:2015-03-11 22:55:33      阅读:135      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!