I am trying to set the height of the UITextView based on the amount of text it will be displaying. I found this solution to this on here:
CGRect frame = _textView.frame;
frame.size.height = _textView.contentSize.height;
_textView.frame = frame;
But I can not get it to work, I think it is something to do with me not adding the UITextView to the view using addSubview correctly, but I can not figure it out! I am sure it is quite an easy fix.
Here is my viewcontroller.m file code
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize textView = _textView;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self.view addSubview: _textView];
CGRect frame = _textView.frame;
frame.size.height = _textView.contentSize.height;
_textView.frame = frame;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end