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;
    //        
    //    }];
        
    }

  • 相关阅读:
    免费的Office批量打印工具 Word、Excel、PDF批量打印
    PHP数据库批量去注释、删字段
    SSL/TLS协议信息泄露漏洞(CVE-2016-2183)【原理扫描】
    CentOS 安装 nginx-1.19.4 与原版本共存
    毕业5年之——上个五年计划复盘20210919
    ubunt 20.04 有道词典命令行工具
    java中针对 try,catch和finally一些总结
    Linux find命令与cp命令连用
    MySQL基本操作笔记
    挖矿病毒排查
  • 原文地址:https://www.cnblogs.com/huoxingdeguoguo/p/5037935.html
Copyright © 2011-2022 走看看