Code iPhone: Resize UITextView follow content
Code iPhone: Resize UITextView follow content
#define MAXSIZE 2000 //MAXSIZE of text view to resize NSString *myText = @"adaydesign’s blog url: https://adayd3sign.wordpress.com/ One stop service and portal of knowledge about iPhone, Android, Blackberry, Window phone7, Flash Platform and HTML5 developer."; //get height of String with font size CGSize fSize = [myText sizeWithFont:[UIFont systemFontOfSize:16] constrainedToSize:CGSizeMake(320, MAXSIZE) lineBreakMode:UILineBreakModeWordWrap]; CGRect cgFrame = CGRectMake(0, (fSize.height+10)*i, 320, fSize.height+10); UITextView *label = [[UITextView alloc] initWithFrame:cgFrame]; [label setFont:[UIFont systemFontOfSize:16]]; [label setScrollEnabled:NO]; label.text = myText;
Detail
adaydesign :)
Posted on มีนาคม 20, 2011, in [Code] iOS and tagged iphone, resize TextView, resize uitextview, Resizing UITextView, systemFontOfSize, TextView, UITextView. Bookmark the permalink. ใส่ความเห็น.
ใส่ความเห็น
Comments 0