标签:
//button UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect ]; button.frame = CGRectMake(50, 200, 50, 50); [button addTarget:self action:@selector(buttonlast) forControlEvents:UIControlEventTouchUpInside]; button.backgroundColor = [UIColor yellowColor]; [button setTitle:@"下一页" forState:UIControlStateNormal]; [button setTitle:@"ganmao" forState:UIControlStateHighlighted]; [self.view addSubview:button]; UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect ]; button1.frame = CGRectMake(200, 200, 50, 50); [button1 addTarget:self action:@selector(buttonpaly:) forControlEvents:UIControlEventTouchUpInside]; button1.backgroundColor = [UIColor yellowColor]; [button1 setTitle:@"流氓" forState:UIControlStateNormal]; [button1 setTitle:@"ganmao" forState:UIControlStateHighlighted]; // button1 setBackgroundImage:<#(UIImage *)#> forState:<#(UIControlState)#>; [self.view addSubview:button1]; //lable UILabel *label =[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 50, 50)]; [label setCenter:CGPointMake(150, 150)]; label.text = @"刀山火海将会是真正的英雄"; label.textColor = [UIColor redColor]; label.font = [UIFont systemFontOfSize:10]; label.backgroundColor = [UIColor clearColor]; label.numberOfLines = 0;//换行 label.textAlignment = NSTextAlignmentCenter;//对齐方式 [self.view addSubview:label]; //textfiend UITextField *textfiend = [[UITextField alloc]init]; textfiend.frame =CGRectMake(20, 20, 200, 20); textfiend.placeholder =@"英雄的名字"; textfiend.secureTextEntry = YES;//安全密码 [textfiend setBorderStyle:UITextBorderStyleRoundedRect];//边框 textfiend.keyboardAppearance = UIKeyboardAppearanceAlert; textfiend.textAlignment = NSTextAlignmentCenter; [self.view addSubview:textfiend]; } -(void)buttonpaly:(UIButton *)sender { [sender setSelected:!sender.selected]; self.view.backgroundColor = sender.selected ? [UIColor whiteColor]:[UIColor blackColor]; NSLog(@"nimei"); } -(void)buttonlast { NextView *next = [[NextView alloc]init]; [self presentViewController:next animated:YES completion:nil]; }UI----安健1 button lable textfiend
标签:
原文地址:http://www.cnblogs.com/daijiahong/p/4484907.html