在单声道触摸中如何创建圆角的图像。我需要将我的UIImage视图转换为圆角的UIImage。有人有参考吗?
答案 0 :(得分:1)
在您的
中添加此内容 UIImage *image = [UIImage imageNamed:@"yourimage.jpg"];
UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, NO, 1.0);
[[UIBezierPath bezierPathWithRoundedRect:imageView.bounds
cornerRadius:10.0] addClip];
[image drawInRect:imageView.bounds];
imageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
答案 1 :(得分:0)
终于得到了答案
UIImageView temp =myimageview;
RectangleF rect = new RectangleF (temp.Frame.X, temp.Frame.Y, temp.Frame.Width, temp.Frame.Height);
temp.Image = UIImage.FromFile("images/imagename.png");
temp.Layer.CornerRadius = temp.Frame.Width/2;
temp.ClipsToBounds = true;
temp.ResizableSnapshotView (rect, true, new UIEdgeInsets (0, 50,0, 0));