scrollView = [[UIScrollView alloc] initWithFrame:
[[UIScreen mainScreen] applicationFrame]];
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(25, 100, 200, 250)];
textView .text =@"long text ";
I will be getting some data of unknown length. to be added to the UITextView . Sometimes the height of the content of the text might exceed the height of the UITextView which is 250 (shown above).
How can i increase the height of the UITextView based on the text i receive ? I would appreciate a sample code?
note: according to my code i am defining the width and height of the UITextView before adding the text to it.
You can use
NSString‘ssizeWithFont:constrainedToSize:lineBreakMode:to get aCGSizestruct telling you how big the text will be.Usage: