#import "MainViewController.h"
@interface MainViewController ()
@end
@implementation MainViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
self.timer = [NSTimer scheduledTimerWithTimeInterval:0.8 target:selfselector:@selector(viewDidLoad) userInfo:nil repeats:YES];
self.color = [[NSMutableArray alloc] initWithObjects:[UIColorredColor], [UIColor orangeColor], [UIColor yellowColor], [UIColorgreenColor], [UIColor cyanColor], [UIColor blueColor], [UIColor purpleColor],nil];
[self.color release];
self.text = [[NSMutableArray alloc] initWithObjects:@"栋", @"栋",@"是", @"大", @"逗", @"逼", @"是", nil];
[self.text release];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.color insertObject:self.color[0] atIndex:7];
[self.color removeObjectAtIndex:0];
// [self.color insertObject:self.color[6] atIndex:0];
// [self.color removeObjectAtIndex:7];
[self.text insertObject:self.text[0] atIndex:7];
[self.text removeObjectAtIndex:0];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320,480)];
view.backgroundColor = self.color[0];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 150, 40,30)];
label.text = self.text[0];
[view addSubview:label];
[label release];
[self.view addSubview:view];
[view release];
UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(40, 0, 280,480)];
view1.backgroundColor = self.color[1];
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 150, 40,30)];
label1.text = self.text[1];
[view1 addSubview:label1];
[label1 release];
[self.view addSubview:view1];
[view1 release];
UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(80, 0, 240,480)];
view2.backgroundColor = self.color[2];
UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 150, 40,30)];
label2.text = self.text[2];
[view2 addSubview:label2];
[label2 release];
[self.view addSubview:view2];
[view2 release];
UIView *view3 = [[UIView alloc] initWithFrame:CGRectMake(120, 0, 200,480)];
view3.backgroundColor = self.color[3];
UILabel *label3 = [[UILabel alloc] initWithFrame:CGRectMake(0, 150, 40,30)];
label3.text = self.text[3];
[view3 addSubview:label3];
[label3 release];
[self.view addSubview:view3];
[view3 release];
UIView *view4 = [[UIView alloc] initWithFrame:CGRectMake(160, 0, 160,480)];
view4.backgroundColor = self.color[4];
UILabel *label4 = [[UILabel alloc] initWithFrame:CGRectMake(0, 150, 40,30)];
label4.text = self.text[4];
[view4 addSubview:label4];
[label4 release];
[self.view addSubview:view4];
[view4 release];
UIView *view5 = [[UIView alloc] initWithFrame:CGRectMake(200, 0, 120,480)];
view5.backgroundColor = self.color[5];
UILabel *label5 = [[UILabel alloc] initWithFrame:CGRectMake(0, 150, 40,30)];
label5.text = self.text[5];
[view5 addSubview:label5];
[label5 release];
[self.view addSubview:view5];
[view5 release];
UIView *view6 = [[UIView alloc] initWithFrame:CGRectMake(240, 0, 80,480)];
view6.backgroundColor = self.color[6];
UILabel *label6 = [[UILabel alloc] initWithFrame:CGRectMake(0, 130, 80,50)];
label6.text = self.text[6];
label6.font = [UIFont systemFontOfSize:50];
[view6 addSubview:label6];
[label6 release];
[self.view addSubview:view6];
[view6 release];
}
- (void)dealloc
{
[_timer release];
[_color release];
[super dealloc];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end