UIButton状态:

UIControlStateNormal          // 正常状态   
UIControlStateHighlighted     // 高亮状态   
UIControlStateDisabled        // 禁用状态    
UIControlStateSelected        // 选中状态    
UIControlStateApplication     //     
UIControlStateReserved        // 保留状态
 

UIButton类型:

UIButtonTypeCustom            //自定义类型
 添加图片: 
IPhone UIButton 属性
 灰色背景颜色:
IPhone UIButton 属性
UIButtonTypeRoundedRect       //圆角类型
IPhone UIButton 属性
UIButtonTypeDetailDisclosure   //细节展示按钮
IPhone UIButton 属性
UIButtonTypeInfoLight          //浅色背景的信息按钮
IPhone UIButton 属性
UIButtonTypeInfoDark           //暗色背景的信息按钮
IPhone UIButton 属性
UIButtonTypeContactAdd         // 添加按钮
IPhone UIButton 属性
 
创建UIButton
1. UIButton *button = [[UIButton alloc] initWithFrame: CGRectMake (x, y, Width, Height)];    
 
2. UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom] retain];  
 
设置UIButton标题
[button setTitle:title forState:UIControlStateNormal];    
 
设置UIButton标题颜色
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
 
设置UIButton背景图片
[button setBackgroundImage:newImage forState:UIControlStateNormal];
 
设置UIButton背景颜色
button.backgroundColor = [UIColor clearColor];

相关文章:

  • 2021-12-04
  • 2021-11-07
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2022-12-23
  • 2021-12-14
  • 2022-03-03
  • 2021-12-04
  • 2021-11-07
  • 2022-02-05
  • 2021-11-19
相关资源
相似解决方案