How to limit the width and height in UITextView?
<p>I want to make a UITextView which have a maximum width and a minimum height.Just like chat bubble in "message" App in our iPhone.
I tryed to use <strong>sizeThatFits</strong>.But it didn't give me a wonderful size.</p>

<pre><code>NSString *string = @"hello everyone";
_textView = [[UITextView alloc] init];
_textView.font = [UIFont systemFontOfSize:16];
_textView.text = string;
[self.view addSubview:_textView];

CGSize size = [string sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]}];
CGFloat finalWidth = MIN(250, size.width);
CGSize constraintSize = CGSizeMake(finalWidth, MAXFLOAT);
CGSize finalSize = [_textView sizeThatFits:constraintSize];
_textView.frame = CGRectMake(0, 0, finalSize.width, finalSize.height);
</code></pre>

<p>I know there are something wrong with my code.So I wonder a good way to limit the width and height in UITextView correctly.
    Thanks    </p>

<hr>

<p>some friends tell me to use Autolayout.Then I try to do it.Here is my code</p>

<pre><code>   [_textView mas_makeConstraints:^(MASConstraintMaker *maker){
    maker.right.equalTo(self.mas_left);
    maker.top.equalTo(self.mas_top);
    maker.width.lessThanOrEqualTo(@(250));
    maker.height.greaterThanOrEqualTo(@(40));
}];
</code></pre>

<p>But it doesn't work unless I use <strong>[_textView sizeToFit]</strong>
Is there anything wrong with my constraints? I want textView adjust itself according to its content!</p>