首页 > 移动平台 > 详细

IOS把图片做成圆形效果

时间:2014-05-22 22:50:37      阅读:561      评论:0      收藏:0      [点我收藏+]

  利用CAShapeLayer可以制作出任意的几何图形,把它作为UIImageView的遮罩,达到把图片做成圆形效果。 

 

 imgView =  [[UIImageView alloc]initWithFrame:CGRectMake(10, 35, 80, 80)];
    imgView.image = [UIImage imageNamed:@"ma.jpg"];
    UIBezierPath* path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(40, 40) radius:40 startAngle:0 endAngle:2*M_PI clockwise:YES];
    CAShapeLayer* shape = [CAShapeLayer layer];
    shape.path = path.CGPath;
    imgView.layer.mask = shape;
    [self.view addSubview:imgView];


IOS把图片做成圆形效果,布布扣,bubuko.com

IOS把图片做成圆形效果

原文:http://blog.csdn.net/quanqinyang/article/details/26463023

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