Reputation: 1017
I can not set the height while running of the UITextView object in Xcode for iPhone (Version 4.6 (4H127). I have used MainStoryboard_iPhone.storyboard to create the UITextView.
I have tried this, which makes no effect:
UITextView *textMultiLine1;
[textMultiLine1 setContentSize:CGSizeMake(320, 320)];
Thanks for answering, I am a very beginner in Xcode.
Upvotes: 1
Views: 1640
Reputation: 1250
You first need to create an Outlet in you header file:
IBOutlet UITextView *textMultiLine1;
Then you need to connect it in the StoryBoard:
Then you must set it's frame:
textMultiline1.frame = CGRectMake(originX, originY, width, height);
Or, if you want to change only it's height:
float newHeight = 200.0;
CGRect textViewFrame = textMultiline1.frame;
textMultiline1.frame = CGRectMake(textViewFrame.origin.x, textViewFrame.origin.y, textViewFrame.size.width, newHeight);
Setting the content size will only change the inner TextView area, resulting in a longer (or shorter, depending on the values you set) scroll
Upvotes: 1