zoukankan      html  css  js  c++  java
  • 监听键盘frame变化

    /**
     * 监听键盘的弹出和隐藏
     */
    - (void)keyboardWillChangeFrame:(NSNotification *)note
    {
        // 键盘最终的frame
        CGRect keyboardF = [note.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
        
        // 动画时间
        CGFloat duration = [note.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
        
        [UIView animateWithDuration:duration animations:^{
            self.toolBar.transform = CGAffineTransformMakeTranslation(0,  keyboardF.origin.y - kScreenHeight);
        }];
    }
    
    - (void)setupTextWordToolBar{
        SinceToolBar *toolbar = [SinceToolBar toolBar];
        toolbar.backgroundColor = [UIColor redColor];
        toolbar.width = self.view.width;
        toolbar.height = 44;
        toolbar.y = self.view.height - toolbar.height;
        [self.view addSubview:toolbar];
        self.toolBar = toolbar;
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
    }
  • 相关阅读:
    操作符重载
    虚继承
    虚函数(2)
    基类与子类的成员函数的关系
    虚函数
    虚函数的简单应用
    齐国的粮食战
    纯虚函数
    类的继承(2)
    输出自定义日期格式
  • 原文地址:https://www.cnblogs.com/HJiang/p/iOS.html
Copyright © 2011-2022 走看看