- (void)dealloc
{
[_window release];
[super dealloc];
}
/*
- (void)test
{
UIView *view = [self.window viewWithTag:100];
view.backgroundColor = [UIColor redColor];
}
*/
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
/*
Window *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window = window;
[window release];
*/
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease];
self.window.backgroundColor = [UIColor blackColor];
[self.window makeKeyAndVisible];
/*
UIView *blueView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
blueView.backgroundColor = [UIColor blueColor];
NSLog(@"%@",NSStringFromCGRect(blueView.bounds));
[self.window addSubview:blueView];
NSLog(@"%@",self.window.subviews);
*/
/*
UIView *yellowView = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 50, 50)];
yellowView.backgroundColor = [UIColor yellowColor];
[self.window addSubview:yellowView];
[yellowView release];
UIView *greenView = [[UIView alloc]initWithFrame:CGRectMake(150, 150, 50, 50)];
greenView.backgroundColor = [UIColor greenColor];
[self.window addSubview:greenView];
[greenView release];
CGRect test = CGRectMake(100, 150, 50, 50);
UIView *redView = [[UIView alloc]initWithFrame:test];
redView.backgroundColor = [UIColor redColor];
[self.window addSubview:redView];
[redView release];
*/
/*
UIView *yellowView = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];
yellowView.backgroundColor = [UIColor yellowColor];
yellowView.bounds = CGRectMake(30, 0, 200, 200);
[self.window addSubview:yellowView];
yellowView.alpha = 1;
UIView *greenView = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
greenView.backgroundColor = [UIColor greenColor];
[yellowView addSubview:greenView];
greenView.alpha = 0.5;
greenView.tag = 100;
[self.window insertSubview:yellowView atIndex:3];
NSLog(@"%@",self.window.subviews);
[self test];
[blueView release];
[yellowView release];
[greenView release];
UIView *containView = [[UIView alloc]initWithFrame:CGRectMake(20, 20, 250, 180)];
containView.backgroundColor = [UIColor lightGrayColor];
[self.window addSubview:containView];
containView.center = CGPointMake(190, 280);
UIView *redView1 = [[UIView alloc]initWithFrame:CGRectMake(30, 30, 60, 30)];
redView1.backgroundColor = [UIColor redColor];
[containView addSubview:redView1];
UIView *redView2 = [[UIView alloc]initWithFrame:CGRectMake(30, 70, 60, 30)];
redView2.backgroundColor = [UIColor redColor];
[containView addSubview:redView2];
UIView *blueView1 =[[UIView alloc]initWithFrame:CGRectMake(110, 30, 110, 30)];
blueView1.backgroundColor = [UIColor blueColor];
[containView addSubview:blueView1];
UIView *blueView2 =[[UIView alloc]initWithFrame:CGRectMake(110, 70, 110, 30)];
blueView2.backgroundColor = [UIColor blueColor];
[containView addSubview:blueView2];
UIView *greenView1 =[[UIView alloc]initWithFrame:CGRectMake(30, 120, 50, 30)];
greenView1.backgroundColor = [UIColor greenColor];
[containView addSubview:greenView1];
UIView *greenView2 =[[UIView alloc]initWithFrame:CGRectMake(100, 120, 50, 30)];
greenView2.backgroundColor = [UIColor greenColor];
[containView addSubview:greenView2];
UIView *greenView3 =[[UIView alloc]initWithFrame:CGRectMake(170, 120, 50, 30)];
greenView3.backgroundColor = [UIColor greenColor];
[containView addSubview:greenView3];
[containView release];
[greenView3 release];
[greenView2 release];
[greenView1 release];
[blueView2 release];
[blueView1 release];
[redView2 release];
[redView1 release];
*/
UIView *containView = [[UIView alloc]initWithFrame:CGRectMake(20, 20, 250, 180)];
containView.backgroundColor = [UIColor lightGrayColor];
[self.window addSubview:containView];
containView.center = CGPointMake(190, 280);
[containView release];
/**
* UILabel:显示文本的控件 任何控件的创建都是分为4步
*/
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 300, 150)];
label.backgroundColor = [UIColor whiteColor];
label.text = @"nozuonodie";
label.textColor = [UIColor purpleColor];
label.textAlignment = NSTextAlignmentCenter;
label.lineBreakMode = NSLineBreakByCharWrapping;
label.numberOfLines = 3;
label.shadowColor = [UIColor blackColor];
label.shadowOffset = CGSizeMake(2, 1);
[containView addSubview:label];
[label release];
NSArray *arr = [UIFont familyNames];
NSLog(@"%@",arr);
NSArray *fontArr = [UIFont fontNamesForFamilyName:@"Lao Sangam MN"];
NSLog(@"%@",fontArr);
label.font = [UIFont fontWithName:@"LaoSangamMN" size:30];
label.font = [UIFont systemFontOfSize:25];
return YES;
}