0
I’m creating a screen where there’s a UITextView
which receives the content of a Web Service, I would like to know how to UITextView
resize according to the amount of content obtained, without creating a Scroll in the text, only the View has a UIScrollView
that according to the size of the UITextView
it determines the size of the scope of the UIScrollView
on the screen, I was able to do but only when I change the content, the problem is that I will not change, because the content comes through a feed. Could someone help me?
-(void)textViewDidChange:(UITextView *)textView{
CGFloat fixedWidth = textView.frame.size.width;
CGSize newSize = [textView sizeThatFits:CGSizeMake(fixedWidth, MAXFLOAT)];
CGRect newFrame = textView.frame;
newFrame.size = CGSizeMake(fmaxf(newSize.width, fixedWidth), newSize.height);
textView.frame = newFrame;
}
Checked my answer below?
– Thomás Pereira