小编cth*_*ase的帖子

使用UIImagePNGRepresentation保存UIImage不保留我的图层修改

我正在从NSData加载图像.原始图像是作为JPG创建的.当我尝试设置角半径并保存到磁盘时,我正在丢失我所做的更改.我将PNG保存为磁盘,因为我认为将在需要保留的图层上创建alpha通道.

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithData:data]];
[imageView.layer setMasksToBounds:YES];
[imageView.layer setCornerRadius:10.0f];
data = UIImagePNGRepresentation(imageView.image);
// save data to file with .png extension
Run Code Online (Sandbox Code Playgroud)

问题是当我将图像从文件系统重新加载回UIImage时,角半径不可见.

objective-c calayer uiimage ios

2
推荐指数
1
解决办法
5649
查看次数

标签 统计

calayer ×1

ios ×1

objective-c ×1

uiimage ×1