1、监听键盘改变的通知

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

2、实现通知方法

/**

 *  给键盘的frame改变添加监听

 *  @param keyBoardWillChangeFrame: 监听方法

 */

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

    // 键盘显示\隐藏完毕的frame

    CGRect frame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];

    // 动画时间

    CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];

    if (frame.origin.y == JYEScreenHeight) { // 没有弹出键盘

        [UIView animateWithDuration:duration animations:^{

            self.toolBarView.transform =  CGAffineTransformIdentity;

        }];

    }else{ // 弹出键盘

        // 工具条往上移动258

        [UIView animateWithDuration:duration animations:^{

            self.toolBarView.transform = CGAffineTransformMakeTranslation(, -frame.size.height-);

        }];

    }

}

最新文章

  1. JavaScript中数组去除重复
  2. Java cookie和session介绍与区别
  3. C++11 feature: move constructor
  4. [ZZ] Maxwell 架构
  5. EF扩展库(批量操作)
  6. java循环遍历类属性 get 和set值方法
  7. Js扩容
  8. 在WPF中将图片转换成3D图像并可以旋转
  9. C#编程(三十八)----------运算符
  10. 【译】Apache Flink Kafka consumer
  11. C#-流、存储
  12. Cygwin镜像使用
  13. 20155328 《Java程序设计》 实验二(Java面向对象程序设计) 实验报告
  14. DP---(POJ1159 POJ1458 POJ1141)
  15. GridView 基本使用
  16. make cmake catkin_make
  17. WPF设置全局快捷键
  18. python学习(十八) 程序打包
  19. Android开发:《Gradle Recipes for Android》阅读笔记(翻译)4.2——增加自定义task
  20. Delphi Runtime Library在哪里?

热门文章

  1. Indy FTP 警告:Only one TIdAntiFreeze can be active in an application
  2. spring 注解
  3. C++ explicit关键字详解
  4. hadoop2的思想架构
  5. JAVA基础再回首
  6. ByteBuf和相关辅助类
  7. 桶装水 送水 消费充值PDA会员管理系统 介绍
  8. grunt 一个目录下所有的js文件压缩 配置收藏
  9. 【BZOJ】3922: Karin的弹幕
  10. 解决Windows Server2008R2中导入Excel不能使用Jet 4.0