美文网首页
Swift 3.0 键盘弹起获取键盘高度

Swift 3.0 键盘弹起获取键盘高度

作者: Dev | 来源:发表于2016-10-21 09:17 被阅读1719次

    NotificationCenter.default.addObserver(self, selector: #selector(keybordShow(notification:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)


    //键盘弹起

    func keybordShow(notification:Notification)  {

    let userinfo: NSDictionary = notification.userInfo! as NSDictionary

    let nsValue = userinfo.object(forKey: UIKeyboardFrameEndUserInfoKey) as! NSValue

    let keyboardRec = nsValue.cgRectValue

    let height = keyboardRec.size.height

    print("keybordShow:\(height)")

    }

    UIView*backView = [[UIViewalloc]initWithFrame:CGRectMake(0,0, Main_Screen_Width,49)];

    backView.backgroundColor= [UIColorredColor];

    [self.tabBarinsertSubview:backViewatIndex:0];

    self.tabBar.opaque=YES;

    相关文章

      网友评论

          本文标题:Swift 3.0 键盘弹起获取键盘高度

          本文链接:https://www.haomeiwen.com/subject/rgiquttx.html