zoukankan      html  css  js  c++  java
  • 用通知监听键盘的出现与消失,与获取键盘高度

      // let keyBoardView = UIView()

     //****************

    //      let center = NotificationCenter.default

    //      center.addObserver(self, selector: #selector(willShow(notic:)), name: NSNotification.Name.UIKeyboardWillShow, object: nibName)

    //      center.addObserver(self, selector: #selector(willHide(notice:)), name: NSNotification.Name.UIKeyboardWillHide, object: nibName)

    //      center.addObserver(gardenInfoExpandView(), selector: #selector(gardenInfoExpandView.clickRightBtn), name: NSNotification.Name.UIKeyboardWillHide, object: nibName)

    //*******

    //   func willShow(notic: NSNotification){

    //      if let ty = (notic.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.height,

    //         let animDur = notic.userInfo?[UIKeyboardAnimationDurationUserInfoKey] as? Double {

    //         UIView.animate(withDuration: animDur, animations: { () -> Void in

    //         self.keyBoardView.frame = CGRectMake(0, screenHeight() - 30 - ty, screenWidth(), 30)

    //         self.keyBoardView.backgroundColor = UIColor(hex: "dededc")

    //         

    //         self.btn.frame = CGRectMake(screenWidth() - 90, screenHeight() - 30 - ty, 90, 30)

    //         self.btn.setTitle("完成", for: .normal)

    //         self.view.addSubview(self.keyBoardView)

    //         self.view.addSubview(self.btn)

    //         self.btn.addTarget(self, action: #selector(self.willHide), for: .touchUpInside)

    //         })

    //      }

    //   }

    //   func willHide(notice:NSNotification){

    //      dismissKeyboard()

    //      keyBoardView.removeFromSuperview()

    //      btn.removeFromSuperview()

    //   }

  • 相关阅读:
    数据库秒级平滑扩容架构方案
    利用SQL索引提高查询速度
    SQL Server调优系列进阶篇(如何维护数据库索引)
    SQL Server调优系列进阶篇(如何索引调优)
    SQL语法集锦一:显示每个类别最新更新的数据
    TreeView中节点勾选设置
    C# WinForm捕获全局异常
    SQL SERVER 查询死锁
    DataTable导入到Excel文件
    Microsoft SyncToy 文件同步工具
  • 原文地址:https://www.cnblogs.com/linximu/p/6077364.html
Copyright © 2011-2022 走看看