/**********************************************************************************/
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window =[[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
self.window.backgroundColor =[UIColor whiteColor];
[self.window makeKeyAndVisible];
[_window release];
UIViewController *vc =[[UIViewController alloc]init];
self.window.rootViewController =vc;
[vc release];
// UIView *view1 =[[UIView alloc] initWithFrame:CGRectMake(80, 80, 100, 100)];
// view1.backgroundColor =[UIColor blackColor];
// [self.window addSubview:view1];
// [view1 release];
//
// UIView *view2 =[[UIView alloc] initWithFrame:CGRectMake(100, 150, 100, 100)];
// view2.backgroundColor =[UIColor redColor];
// [self.window addSubview:view2];
// [view2 release];
//UILabel
UILabel *label1 =[[UILabel alloc] initWithFrame:CGRectMake(80, 80, 100, 100)];
label1.backgroundColor =[UIColor yellowColor];
[self.window addSubview:label1];
[label1 release];
/// 给label添加文本
label1.text =@"程锦乐,afadf,水电费是sf, 阿斯顿发撒旦,dfgdfg,dfgdfg,dfgdfgd";
///设置文本的颜色
label1.textColor =[UIColor greenColor];
/// 设置文本的对齐方式
label1.textAlignment =NSTextAlignmentCenter;
///设置文本字体大小
label1.font =[UIFont systemFontOfSize:15];
/// 设置行数
label1.numberOfLines =0;
[label1 sizeToFit];
//想通过这两方法进行自适应的话,必须先有文本,后有对行数和sizeToFit的设置
//它会自动修改尺寸,把高度增加
NSLog(@"%g",label1.frame.size.height);
// shadw 增加阴影
label1.shadowColor = [UIColor redColor];
// shadw 扩充阴影
label1.shadowOffset =CGSizeMake(2, 2);
//center只能设置位置,而且还是中心点的位置
//frame都可以进行设置
label1.center =CGPointMake(0, 0);
label1.center =CGPointMake(100+label1.frame.size.width / 2 , 100+label1.frame.size.height / 2);
/// 随机颜色
[UIColor colorWithRed:arc4random()%256/255.0 green:arc4random()%256/255.0 blue:arc4random()%256/255.0 alpha:1];
return YES;
}