//UIButton
UIButton *button=[UIButton buttonWithType:UIButtonTypeSystem];
button.frame=CGRectMake(100, 100, 100, 100);
button.backgroundColor=[UIColor yellowColor];
//外观控制
[button setTitle:@"按钮" forState:UIControlStateNormal];
//加背景
// [button setBackgroundImage:[UIImage imageNamed:@"1.png"] forState:UIControlStateNormal];
//设置文字颜色
[button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//第二种改变字体颜色方法
button.tintColor=[UIColor blackColor];//渲染颜色
//响应事件
[button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
[bgView addSubview:button];
[bgView release];
//设置
//文字
[button setTitle:@"按钮" forState:UIControlStateNormal];
//文字颜色
[button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//背景图片
[button setBackgroundImage:[UIImage imageNamed:@"1.pug"] forState:UIControlStateNormal];
//添加事件
[button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
//添加前景图片(需要镂空png图片)
[button setImage:[UIImage imageNamed:@"2.png"] forState:UIControlStateNormal];
//获取button上的文字
NSString *butString = [button titleForState:UIControlStateNormal];
NSLog(@"文字:%@",butString);
//获取button上文字的颜色
UIColor *buttonColor = [button titleColorForState:UIControlStateNormal];
NSLog(@"%@",buttonColor);
//获取前景图片
UIImage *buttonImage = [button imageForState:UIControlStateNormal];
//获取背景图片
UIImage *butBgImage = [button backgroundImageForState:UIControlStateNormal];
[self.window addSubview:button];
[bgview release];
*/