2010-01-19 7 views

답변

5

...

UITextView *textView; // your UITextView 
NSString *text; // the text that you want to place in the UITextView 
UIFont *textViewFont; // the font that you are using for your UITextView 

CGSize size = {255,2000.0f}; //The default width, and max height you want to use 

CGSize newSize = [text sizeWithFont:textViewFont 
       constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap]; 

textView.frame = CGRectMake(0,0,newSize.width, newSize.height); 
0

이 시도 할 수 있습니다 ..

CGRect frame = textView.frame; 
frame.size.height = [textView contentSize].height; 
textView.frame = frame; 
관련 문제