UIBotton基础信息+(三原色调色)

1,按钮的状态(state)
//按钮的正常状态
UIControlStateNormal 
//按钮被点击是的状态
UIControlStateHighlighted
//按钮被禁止点击时的状态
UIControlStateDisabled 
//按钮被点击后的状态
UIControlStateSelected

2给按钮添加标题(setTitle)并且说明是给什么状态下添加标题
[[UIButton alloc]initWithFrame:CGRectMake(40, 43, 200, 50)] setTitle:@"假设" forState: UIControlStateNormal];
同样的,给其设置图片(setImage) 设置字体颜(setTitleColor)等也能这么做.button的禁用 button.hidden = NO;

 添加事件与响应方式  [listBtn addTarget:self action:@selector(listButtonDidClicked:) forControlEvents:UIControlEventTouchUpInside];
//   设置前景图片
[_buttont setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];

// 设置背景图片
[_buttont setBackgroundImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
//设置字体颜色
[_buttont setTitleColor:<#(nullable UIColor *)#> forState:<#(UIControlState)#>]```

3

 ***
> `设置此类类型的系统自定的特色按钮图片(https://img-blog.csdn.net/20180812101605806?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyODkxNzA5/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)

  UIButton*uib=[UIButton buttonWithType:UIButtonTypeContactAdd];
//按钮中的风格图片大小已固定不可改变,只能改变他的位置
uib.frame = CGRectMake(100, 100, 200, 50);
self.view addSubview:uib];`
***

self.loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_loginBtn.frame = CGRectMake(50, 200, self.view.frame.size.width-100, 50);

[_loginBtn setTitle:@"登录" forState:UIControlStateNormal];
_loginBtn.backgroundColor = [UIColor grayColor];
_loginBtn.enabled = NO;
[self.view addSubview:_loginBtn];


//如何自己调试颜色 (通过测色计获得三元色的值,再分别除以255.0)
_loginBtn.backgroundColor = [UIColor colorWithRed:167/255.0 green:57/255.0 blue:61/255.0 alpha:1];

“`

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值