与UIActivityViewController共享ALAsset fullResolutionImage

时间:2013-02-06 09:41:43

标签: ios share assets

似乎无法在电子邮件中嵌入完整分辨率资源。如果我使用fullScreenImage表示,它会很好用。我想图像尺寸应该有一些限制,但我找不到任何有关它的信息。我在iPhone 4S上,全分辨率图像为2448 x 3264像素。

代码:

ALAssetRepresentation *assetRepresentation = [_asset defaultRepresentation];
CGImageRef imageRef = [assetRepresentation fullResolutionImage];
UIImage *img = [UIImage imageWithCGImage:imageRef scale:[assetRepresentation scale] orientation:[assetRepresentation orientation]];

UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:@[img] applicationActivities:nil];
[self presentViewController:activityController animated:YES completion:nil];

谢谢!

1 个答案:

答案 0 :(得分:0)

以下解决方案是......而不是将fullResolutionImage添加到要共享的数据数组中,而是添加实际资产本身。

UIActivityViewController *activityController = [[UIActivityViewController alloc]    initWithActivityItems:@[_asset] applicationActivities:nil];
[self presentViewController:activityController animated:YES completion:nil];

其中_asset是图像的ALAsset实例。