首页 > 移动平台 > 详细

ios 给控件选择性设置圆角

时间:2015-09-09 22:36:20      阅读:231      评论:0      收藏:0      [点我收藏+]

 UILabel * label =[[UILabel alloc]initWithFrame:CGRectMake(100, 200, 100, 100)];
    
    label.backgroundColor=[UIColor cyanColor];
    [self.view addSubview:label];
    
    //贝塞尔曲线
    UIBezierPath * bezierPath2=[UIBezierPath bezierPathWithRoundedRect:label.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
    
    //根据贝塞尔曲线进行边缘描绘 只能进行边缘描绘 不能进行填充
    CAShapeLayer *layer2 =[CAShapeLayer layer];
    
    layer2.path=bezierPath2.CGPath;
    layer2.frame=label.bounds;
    layer2.lineWidth=1;
    
    layer2.lineWidth=1;
    
    label.layer.mask=layer2;

ios 给控件选择性设置圆角

原文:http://www.cnblogs.com/wangbinbin/p/4796107.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!