获取键盘的y

2017-06-12  本文已影响8人  杨大虾

1.监听键盘

    [[NSNotificationCenter defaultCenter] addObserver:view selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
- (void)keyboardWillShow:(NSNotification *)notification{
    //取得键盘最后的frame
    CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
    CGFloat height = keyboardFrame.origin.y;
    
}
上一篇下一篇

猜你喜欢

热点阅读