标签:blog http io ar color os sp on 2014
#import "ViewController.h"
@interface ViewController ()
{
UILabel *dynamicLabel;
}
@end
@implementation ViewController
- (void)viewDidLoad {
if (!dynamicLabel) {
dynamicLabel=[[UILabel alloc]init];
}
dynamicLabel.backgroundColor=[UIColor redColor];
dynamicLabel.font=[UIFont fontWithName:@"HelveticaNeue" size:24.0f];
dynamicLabel.text=@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eu urna quis lacus imperdiet scelerisque a nec neque. Mauris eget feugiat augue, vitae porttitor mi. Curabitur vitae sollicitudin augue. Donec id sapien eros. Proin consequat tellus in vehicula sagittis. Morbi sed felis a nibh hendrerit hendrerit. Lorem ipsum dolor sit.";
dynamicLabel.lineBreakMode=NSLineBreakByWordWrapping;
dynamicLabel.numberOfLines = 0;
CGRect tempRect=[dynamicLabel.text boundingRectWithSize:CGSizeMake(300,1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:dynamicLabel.font,NSFontAttributeName, nil] context:nil];
dynamicLabel.frame=CGRectMake(10, 64, tempRect.size.width, tempRect.size.height);
[self.view addSubview:dynamicLabel];
}
标签:blog http io ar color os sp on 2014
原文地址:http://www.cnblogs.com/thbbsky/p/4120956.html