iOS背景色 圆切角 边框色

iOS视图颜色与图层样式设置
本文介绍iOS开发中使用UIColor设置视图背景色的方法,并演示如何通过UIView的layer属性来实现圆角和边框效果。
UIColor *color1=[UIColor colorWithRed:155/255 green:255/255 blue:255/255 alpha:1];//方法1,使用 静态方法创建color  
      
    _view1.backgroundColor=color1;  
      
    UIColor *color2=[[UIColor alloc] initWithRed:222/255 green:213/255 blue:221/255 alpha:1];//方法2,使用 实例方法 创建color  
      
    [_view2 setBackgroundColor:color2];  

self.navigationController.navigationBar.backgroundColor = [UIColor colorWithRed:253/255.0 green:50/255.0 blue:58/255.0 alpha:1.0];

!!!!要加.0切记

 

//[UIColor colorWithRed:143/255.0 green:186/255.0 blue:55/255.0 alpha:1.0];//呼伦贝尔草原绿

 

 

//将图层的边框设置为圆脚  
myWebView.layer.cornerRadius = 8;
   
myWebView.layer.masksToBounds = YES;  
//给图层添加一个有色边框         
 myWebView.layer.borderWidth = 5;
          
myWebView.layer.borderColor = [[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor];
   

 

转载于:https://www.cnblogs.com/gaozhang12345/p/6424570.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值