小编Yij*_*jun的帖子

更改inputAccessoryView问题的高度

当我更改inputAccessoryViewiOS 8中的高度时,inputAccessoryView不会转到右侧原点,而是覆盖键盘.

在此输入图像描述

以下是一些代码段:

在表视图控制器中

- (UIView *)inputAccessoryView {
    if (!_commentInputView) {
        _commentInputView = [[CommentInputView alloc] initWithFrame:CGRectMake(0, 0, [self width], 41)];
        [_commentInputView setPlaceholder:NSLocalizedString(@"Comment", nil) andButtonTitle:NSLocalizedString(@"Send", nil)];
        [_commentInputView setBackgroundColor:[UIColor whiteColor]];
        _commentInputView.hidden = YES;
        _commentInputView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin;
    }

    return _commentInputView;
}
Run Code Online (Sandbox Code Playgroud)

在CommentInputView中

#when the textview change height
- (void)growingTextView:(HPGrowingTextView *)growingTextView willChangeHeight:(float)height {
    if (height > _textView_height) {
        [self setHeight:(CGRectGetHeight(self.frame) + height - _textView_height)];
        [self reloadInputViews];
    }
}
Run Code Online (Sandbox Code Playgroud)

来自ios-helpers的 UIView类别

- (void)setHeight: (CGFloat)heigth {
    CGRect frame = self.frame;
    frame.size.height …
Run Code Online (Sandbox Code Playgroud)

ios inputaccessoryview ios8

17
推荐指数
2
解决办法
9198
查看次数

标签 统计

inputaccessoryview ×1

ios ×1

ios8 ×1