Eri*_*hao 6 iphone photo ios ios9 phlivephoto
我尝试用JPG文件和MOV文件制作实时照片.就像这样:
CGSize targetSize = CGSizeZero;
PHImageContentMode contentMode = PHImageContentModeDefault;
__weak NSURL *videoUrl;
__weak NSURL *photoUrl;
// Call private API to create the live photo
self.livePhotoView.livePhoto = nil;
self.livePhoto = nil;
self.livePhoto = [[PHLivePhoto alloc] init];
SEL initWithImageURLvideoURL = NSSelectorFromString(@"_initWithImageURL:videoURL:targetSize:contentMode:");
if ([self.livePhoto respondsToSelector:initWithImageURLvideoURL]) {
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self.livePhoto methodSignatureForSelector:initWithImageURLvideoURL]];
[invocation setSelector:initWithImageURLvideoURL];
[invocation setTarget:self.livePhoto];
[invocation setArgument:&(photoURL) atIndex:2];
[invocation setArgument:&(videoUrl) atIndex:3];
[invocation setArgument:&(targetSize) atIndex:4];
[invocation setArgument:&(contentMode) atIndex:5];
[invocation invoke];
}
// Set the live photo
self.livePhotoView.livePhoto = self.livePhoto;
Run Code Online (Sandbox Code Playgroud)
最后,我得到了实时照片并在livePhotoView中显示它.然后我尝试保存或分享它.我使用Class UIActivityViewController.Like this:
if (self.livePhoto) {
UIActivityViewController *activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:@[self.livePhotoView.livePhoto]
applicationActivities:nil];
[self presentViewController:activityViewController
animated:YES
completion:^{
// ...
}];
}
Run Code Online (Sandbox Code Playgroud)
当我分享实时照片时,我分享的只是静止图像.当我选择保存实时照片时,我在相册中找不到任何内容.我在很多地方搜索.我只是在这个https:// github中找到一些信息.com/genadyo/LivePhotoDemo/issues/3.但它没有解决我的问题.
我发现一个应用程序可以在AppStore中完成.但我无法理解它是如何工作的.https://itunes.apple.com/cn/app/livemaker-free-for-live-photo/id1053967828?mt=8
| 归档时间: |
|
| 查看次数: |
857 次 |
| 最近记录: |