美文网首页
简单试试Live Photo怎么用

简单试试Live Photo怎么用

作者: Johnny_Chang | 来源:发表于2016-11-20 17:26 被阅读65次

    http://nicreals.github.io/2016/03/09/Live-Photo/#more(此人博客不错)

    另外jianshu关注了部分文章,也不错

    自己的代码

    - (IBAction)choosePhotos:(id)sender {

    UIImagePickerController*picker = [[UIImagePickerControlleralloc]init];

    picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;

    picker.allowsEditing=NO;

    picker.delegate=self;

    NSArray*mediaTypes =@[(NSString*)kUTTypeImage,(NSString*)kUTTypeLivePhoto];

    picker.mediaTypes= mediaTypes;

    [selfpresentViewController:pickeranimated:YEScompletion:nil];

    }

    - (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

    {

    [selfdismissViewControllerAnimated:YEScompletion:^{

    PHLivePhoto*photo = [infoobjectForKey:UIImagePickerControllerLivePhoto];

    if(photo)

    {

    PHLivePhotoView*photoView = [[PHLivePhotoViewalloc]initWithFrame:self.view.bounds];

    photoView.livePhoto= [infoobjectForKey:UIImagePickerControllerLivePhoto];

    photoView.contentMode=UIViewContentModeScaleAspectFill;

    [self.viewaddSubview:photoView];

    }else

    {

    //self.LivePhotos.image =

    NSLog(@"普通相片");

    }

    }];

    }

    注意:

    1.plist :Privacy - Photo Library Usage Description

    2.#import 《photo。h》

    3.

    相关文章

      网友评论

          本文标题:简单试试Live Photo怎么用

          本文链接:https://www.haomeiwen.com/subject/barypttx.html