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 }
  • 相关阅读:
    teamviewer被识别为商用的解决办法
    PLY调试笔记——待解决的问题
    python中的反射
    类的继承顺序
    面向对象---继承
    类成名和命名空间
    面向对象编程
    模块的初始
    装饰器
    列表推导式,生成器
  • 原文地址:https://www.cnblogs.com/lz465350/p/8312549.html
Copyright © 2011-2022 走看看