- (UIImage*)drawImageWithSize:(CGSize)size imageName:(NSString *)imageName
{
// 申请一块特定大小的画布
UIGraphicsBeginImageContext(size);
// 画出一个与画布等大的圆
UIBezierPath *path = [UIBezierPathbezierPathWithOvalInRect:CGRectMake(0,0, size.width, size.height)];
// 将这个圆以外的部分设置为无效区
[path addClip];
UIImage *oldImage = [UIImageimageNamed:imageName];
[oldImage drawInRect:CGRectMake(0,0, size.width, size.height)];
UIImage *newImage =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
imageView.image =newImage;
新闻热点
疑难解答