UIGraphicsBeginImageContext(self.tabView.bounds.size);
UIGraphicsBeginImageContextWithOptions(self.tabView.bounds.size, YES, self.tabView.layer.contentsScale);
[self.tabView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"sms.jpg"]]; // 保存文件的名称
BOOL result = [UIImagePNGRepresentation(img)writeToFile: filePath atomically:YES];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"sms.jpg"]]; // 保存文件的名称
UIImage *imgs = [[UIImage alloc] initWithContentsOfFile:filePath];
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。