步骤:
1.首先创建一个UIView,然后在drawRect里面获取上下文。
2.绘制圆形路径,使用CGContextClip才剪掉圆形路径以外的东西
3.获取图片,使用drawInRect将图片绘制在圆形路径内
------------------------------代码实现--------------------------
CGContextRef context= UIGraphicsGetCurentContext();
CGRect imageRect = CGRectMake(0,0,width,height);
CGContextAddEllipseRect(context, ImageRect); //获取椭圆路径
CGContextClip(context); //裁剪椭圆路径
UIImage *Image = [UIImage imageNamed:@""];
[image drawInRect(imageRect)];
CGContextStrokePath(context);