IOS把图片做成圆形效果

  利用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把图片做成圆形效果

上一篇:app,h5,自动化 --L简


下一篇:赵雅智_Android短信发送器