2013. 10. 28. 15:53 아이폰


앱에서 이미지 겔러리로 저장

-(void)saveImageatAlbum:(UIImage *)img

{

    //이미지 저장

    [loadingView startLoading];

    UIImageWriteToSavedPhotosAlbum(img, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);

    

}

- (void) image:(UIImage*)image didFinishSavingWithError:(NSError *)error contextInfo:(NSDictionary*)info

{

    [loadingView endLoading];

    if(error == nil)

    {

        [mCp setPopUpSimple:LOCSTRING("이미지 저장 성공!")];

    }else

    {

        [mCp setPopUpSimple:LOCSTRING("이미지 저장 실패!")];

    }

}


앱에서보는 동영상 겔러리로 저장

- (void) downloadVideo:(NSString *)url

{

    //동영상 저장

    [loadingView startLoading];

    

    [self performSelectorOnMainThread:@selector(downloadVideoGo:) withObject:url waitUntilDone:NO];

}

-(void)downloadVideoGo:(NSString *)url

{

    NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];

    NSString *tempPath = [NSString stringWithFormat:@"%@temp.mp4", NSTemporaryDirectory()];

    [imageData writeToFile:tempPath atomically:NO];

    UISaveVideoAtPathToSavedPhotosAlbum (tempPath, self, @selector(video:didFinishSavingWithError: contextInfo:), nil);

}

- (void) video: (NSString *) videoPath didFinishSavingWithError:(NSError *)error  contextInfo:(void *)contextInfo

{

    [loadingView endLoading];

    if(error == nil)

    {

        [mCp setPopUpSimple:LOCSTRING("동영상 저장 성공!")];

    }else

    {

        [mCp setPopUpSimple:LOCSTRING("동영상 저장 실패!")];

    }

    

}


IOS SAVE GALLERY APP IMAGE AND VIDEO

'아이폰' 카테고리의 다른 글

ios auto focus check  (0) 2014.11.18
objective-c 함수포인터를 사용한 함수 호출  (0) 2014.01.03
ios custom keyboard  (0) 2013.06.12
ios arc mrc 설정하기  (0) 2013.03.26
ios gridview  (0) 2013.03.22
posted by 욱이다