zoukankan      html  css  js  c++  java
  • 键盘事件

     1 - (void)buildNotification {
     2     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShowWithNotification:) name:UIKeyboardWillShowNotification object:nil];
     3     
     4     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHideWithNotification:) name:UIKeyboardWillHideNotification object:nil];
     5  }
     6 
     7 - (void)keyboardWillShowWithNotification:(NSNotification *)notification {
     8     CGRect rect = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
     9     CGFloat height = rect.size.height - (kDevice_iPhoneX ? kFloatBottomDangerHeight : 0);
    10 
    11     [UIView animateWithDuration:[notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue] animations:^{
    12         _inputTextView.transform = CGAffineTransformMakeTranslation(0, - height);
    13     }];
    14 }
    15 
    16 - (void)keyboardWillHideWithNotification:(NSNotification *)notification {
    17     [UIView animateWithDuration:[notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue] animations:^{
    18         _inputTextView.transform = CGAffineTransformIdentity;
    19     }];
    20 }
  • 相关阅读:
    CrawlSpiders
    从抓取Tencent中学习Scrapy
    对象返回规范的url的两种方式的两种方式
    多对多关系的额外字段
    Django定时任务
    Scripy学习(一)
    Django开发博客一(搭建模型和准备数据)
    求并集
    求子集、交集
    java数学函数Math类中常用的方法
  • 原文地址:https://www.cnblogs.com/lz465350/p/8312549.html
Copyright © 2011-2022 走看看