//初始化一个图片视图
UIImageView * view = [[UIImageView alloc] init];
CGRect rect = view.bounds;
CGSize size = rect.size;
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
[[UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:size.width] addClip];
[view drawRect:rect];
view.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
网友评论