我正在从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时,角半径不可见.