美文网首页
联合IQKeyboard控制回复栏高度

联合IQKeyboard控制回复栏高度

作者: 我想养只猫 | 来源:发表于2019-01-18 14:55 被阅读9次

-(void)textViewDidChange:(UITextView*)textView{

    floattextViewHeight =  [textViewsizeThatFits:CGSizeMake(textView.frame.size.width,MAXFLOAT)].height;

    if(_Lastheight==0) {

        _Lastheight= textViewHeight;

        return;

    }

    CGRectframe = textView.frame;

    frame.size.height= textViewHeight;

    CGFloatoffY = textViewHeight -_Lastheight;

    frame.origin.y-=offY;

    _Lastheight= textViewHeight;

    textView.frame= frame;

}

-(BOOL)textViewShouldBeginEditing:(UITextView*)textView{

    IQKeyboardManager *manager = [IQKeyboardManager sharedManager];

    [managersetKeyboardDistanceFromTextField:10];

    return YES;

}

-(BOOL)textViewShouldEndEditing:(UITextView*)textView{

    IQKeyboardManager *manager = [IQKeyboardManager sharedManager];

    [managersetKeyboardDistanceFromTextField:20];

    return YES;

}

相关文章

网友评论

      本文标题:联合IQKeyboard控制回复栏高度

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