2016-04-12 64 views
0

我试着改变下面的代码,评论textContainerInset和contentInset,无法找到当我添加文本时容器的框架如何变化,似乎没有什么在textView的委托中以及。修复JSQMessagesViewController textView的大小

- (void)jsq_configureTextView 
{ 
    [self setTranslatesAutoresizingMaskIntoConstraints:NO]; 

    CGFloat cornerRadius = 6.0f; 

    self.backgroundColor = [UIColor whiteColor]; 
    self.layer.borderWidth = 0.5f; 
    self.layer.borderColor = [UIColor lightGrayColor].CGColor; 
    self.layer.cornerRadius = cornerRadius; 

    self.scrollIndicatorInsets = UIEdgeInsetsMake(cornerRadius, 0.0f, cornerRadius, 0.0f); 

    self.textContainerInset = UIEdgeInsetsMake(4.0f, 2.0f, 4.0f, 2.0f); 
    self.contentInset = UIEdgeInsetsMake(1.0f, 0.0f, 1.0f, 0.0f); 

    self.scrollEnabled = YES; 

    self.scrollsToTop = NO; 
    self.userInteractionEnabled = YES; 

    self.font = [UIFont systemFontOfSize:16.0f]; 
    self.textColor = [UIColor blackColor]; 
    self.textAlignment = NSTextAlignmentNatural; 

    self.contentMode = UIViewContentModeRedraw; 
    self.dataDetectorTypes = UIDataDetectorTypeNone; 
    self.keyboardAppearance = UIKeyboardAppearanceDefault; 
    self.keyboardType = UIKeyboardTypeDefault; 
    self.returnKeyType = UIReturnKeyDefault; 

    self.text = nil; 

    _placeHolder = nil; 
    _placeHolderTextColor = [UIColor lightGrayColor]; 

    [self jsq_addTextViewNotificationObservers]; 
} 
+0

您想更改JSQMessageTextView中输入文本的字体吗? –

+0

不,我希望textView不要调整其中添加或删除文本的大小,以及整个contentView(带有左侧附件按钮和右侧发送按钮)不更新帧以增加高度。 –

回答

0

设置JSQMessagesViewController的inputToolbar的maximumHeight就足够了。

self.inputToolbar.maximumHeight = 44