#import <Photos/Photos.h>
- (IBAction)touchedImageSave:(id)sender {
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest *changeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:_imageView.image];
changeRequest.creationDate = [NSDate date];
} completionHandler:^(BOOL success, NSError *error) {
if (success) {
[[Util sharedInstance] showToastMessage:@"저장되었습니다."];
}
else {
[[Util sharedInstance] showToastMessage:[NSString stringWithFormat:@"저장에 실패했습니다. (%@)", error.localizedDescription]];
}
}];
}
- (IBAction)touchedVideoSave:(id)sender {
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^
{
NSURL *url = [NSURL URLWithString:_fileUrl];
[PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:url];
}
completionHandler:^(BOOL success, NSError *error)
{
if (success) {
[[Util sharedInstance] showToastMessage:@"저장되었습니다."];
}
else {
[[Util sharedInstance] showToastMessage:[NSString stringWithFormat:@"저장에 실패했습니다. (%@)", error.localizedDescription]];
}
}];
}
댓글 없음:
댓글 쓰기