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 }
  • 相关阅读:
    js的call方法
    js的call方法
    log4j 详细解释
    log4j 详细解释
    log4j 详细解释
    log4j 详细解释
    google proto buf学习
    google proto buf学习
    网页div转换成图片导出——html2canvas
    走向云端:Oracle SQL Developer Web 即将上线!
  • 原文地址:https://www.cnblogs.com/lz465350/p/8312549.html
Copyright © 2011-2022 走看看