1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
imgView.image = [UIImage imageWithData:item.image];
UIGraphicsBeginImageContextWithOptions(imgView.bounds.size, NO, 1.0);
[[UIBezierPath bezierPathWithRoundedRect:imgView.bounds
cornerRadius:20.0] addClip];
[imgView.image drawInRect:imgView.bounds];
imgView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *rawImageData = [NSData dataWithData:item.image];
UIImage *img = [UIImage imageWithData:rawImageData];
myCell.imageView.image = img; |
Partager