zoukankan      html  css  js  c++  java
  • 判断键盘的高度

    1、系统键盘跟第三方输入法都可以用这个方法

    //    //增加监听,当键盘出现或改变时收出消息
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(keyboardWillShow:)
                                                     name:UIKeyboardWillShowNotification
                                                   object:nil];
        
        //增加监听,当键盘出现或改变时收出消息
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(keyboardWillHide:)
                                                     name:UIKeyboardWillHideNotification
                                                   object:nil];

    - (void) keyboardWillShow:(NSNotification *)notif
    {
        NSDictionary *info = [notif userInfo];
        NSValue *value = [info objectForKey:UIKeyboardFrameEndUserInfoKey];
        keyBoardHeight = [value CGRectValue].size.height;
        
    //    [UIView animateWithDuration:0.3f animations:^{
    //        _appointCourseTV.contentOffset=CGPointMake(0, keyBoardHeight);
    //    } completion:nil];
        
        
    }
    //回收键盘并落下输入框
    - (void)keyboardWillHide:(NSNotification *)notif
    {
        [_remarkTextView resignFirstResponder];
        [UIView animateWithDuration:0.3f animations:^{
            _appointCourseTV.contentOffset=CGPointMake(0, 0);
        } completion:nil];
        
    //    [UIView animateWithDuration:0.3 animations:^{
    //        
    //        CGRect rect = CGRectMake(0, 0, M_S.width, M_S.height);
    //        
    //        self.view.frame = rect;
    //        
    //    }];
        
    }

  • 相关阅读:
    wc项目
    随笔之——伪类选择器:nthchild(n) 与 nthoftype(n)的区别!!!
    随笔之——浮动(float)的影响及其清除、、clear与overflowhidden清除float的不同!!!
    随笔之——各大热门网站search 搜索框的写法,浅析!
    一个简单的注册页面
    自我介绍、目标
    position的6个属性的实验和相关分析
    第二次作业
    第三次作业
    第一次作业
  • 原文地址:https://www.cnblogs.com/huoxingdeguoguo/p/5037935.html
Copyright © 2011-2022 走看看