use code to add Navigation----iphone

UIView *nav=[[UIView allocinit];

nav.frame=CGRectMake(0032044);

nav.backgroundColor=[UIColor blueColor];

UILabel *lab=[[UILabel allocinit];

lab.text=@"分歧终端机";

lab.backgroundColor=[UIColor clearColor];

lab.frame=CGRectMake(110520035);

 

UIButton *BACK_main=[UIButton buttonWithType:UIButtonTypeCustom];

[BACK_main setTitle:@"back" forState:UIControlStateNormal];

BACK_main.frame=CGRectMake(10,10,  4020);

BACK_main.tag=1;

[BACK_main addTarget:self action:@selector(backMAIN:) forControlEvents:UIControlEventTouchUpInside];

[nav addSubview:lab];

 

 

UIButton *restart=[UIButton buttonWithType:UIButtonTypeCustom];

[restart setTitle:@"重玩" forState:UIControlStateNormal];

restart.frame=CGRectMake(250104020);

restart.tag=6;

restart.hidden=YES;

[restart addTarget:self action:@selector(startGame) forControlEvents:UIControlEventTouchUpInside];

[nav addSubview:restart];

[nav addSubview:BACK_main];

[self.view addSubview:nav];

[nav release];

你可能感兴趣的:(use code to add Navigation----iphone)