-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 46b2750
Showing
168 changed files
with
24,205 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
PlayOPC.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// ALAssetsLibrary+CustomAlbum.h | ||
// PlayOPC | ||
// | ||
// Created by Hiroki Ishiura on 2015/05/06. | ||
// Copyright (c) 2015 Hiroki Ishiura. All rights reserved. | ||
// | ||
// Released under the MIT license | ||
// http://opensource.org/licenses/mit-license.php | ||
// | ||
|
||
#import <AssetsLibrary/AssetsLibrary.h> | ||
|
||
@interface ALAssetsLibrary (CustomAlbum) | ||
|
||
/// 写真アルバムのカスタムグループに画像データを書き込みます。 | ||
- (void)writeImageDataToSavedPhotosAlbum:(NSData *)imageData metadata:(NSDictionary *)metadata groupName:(NSString *)groupName completionBlock:(ALAssetsLibraryWriteImageCompletionBlock)completionBlock; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// | ||
// ALAssetsLibrary+CustomAlbum.m | ||
// PlayOPC | ||
// | ||
// Created by Hiroki Ishiura on 2015/05/06. | ||
// Copyright (c) 2015 Hiroki Ishiura. All rights reserved. | ||
// | ||
// Released under the MIT license | ||
// http://opensource.org/licenses/mit-license.php | ||
// | ||
|
||
#import "ALAssetsLibrary+CustomAlbum.h" | ||
|
||
@implementation ALAssetsLibrary (CustomAlbum) | ||
|
||
- (void)writeImageDataToSavedPhotosAlbum:(NSData *)imageData metadata:(NSDictionary *)metadata groupName:(NSString *)groupName completionBlock:(ALAssetsLibraryWriteImageCompletionBlock)completionBlock { | ||
DEBUG_LOG(@"imageData.length=%ld, metadata=%@, group=%@", (long)imageData.length, metadata, groupName); | ||
|
||
// 写真グループに画像を保存します。 | ||
// !!!: weakなselfを使うとenumerateGroupsWithTypes:usingBlock:failureBlock:より内側の処理に到達する前に解放されてしまいます。 | ||
__block ALAssetsLibrary *weakSelf = self; | ||
[weakSelf writeImageDataToSavedPhotosAlbum:imageData metadata:metadata completionBlock:^(NSURL *assetURL, NSError *error) { | ||
if (error) { | ||
if (completionBlock) { | ||
completionBlock(assetURL, error); | ||
} | ||
weakSelf = nil; | ||
return; | ||
} | ||
DEBUG_LOG(@"The image is saved into photos alubm."); | ||
__block BOOL foundGroup = NO; | ||
[weakSelf enumerateGroupsWithTypes:ALAssetsGroupAlbum usingBlock:^(ALAssetsGroup *group, BOOL *stop) { | ||
if (group && [[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:groupName]) { | ||
// 写真アルバムにカスタムグループが見つかった場合はそのグループに保存した画像を登録します。 | ||
DEBUG_LOG(@"Update the exsisted album: groupName=%@", groupName); | ||
foundGroup = YES; | ||
[weakSelf assetForURL:assetURL resultBlock:^(ALAsset *asset) { | ||
[group addAsset:asset]; | ||
if (completionBlock) { | ||
completionBlock(assetURL, nil); | ||
} | ||
weakSelf = nil; | ||
} failureBlock:^(NSError *error) { | ||
if (completionBlock) { | ||
completionBlock(assetURL, error); | ||
} | ||
weakSelf = nil; | ||
}]; | ||
return; | ||
} | ||
if (!group && !foundGroup) { | ||
// 写真アルバムにカスタムグループが見つからなかった場合はグループを新規作成して画像を登録します。 | ||
DEBUG_LOG(@"Create the new album: groupName=%@", groupName); | ||
[weakSelf addAssetsGroupAlbumWithName:groupName resultBlock:^(ALAssetsGroup *group) { | ||
[weakSelf assetForURL:assetURL resultBlock:^(ALAsset *asset) { | ||
[group addAsset:asset]; | ||
if (completionBlock) { | ||
completionBlock(assetURL, nil); | ||
} | ||
weakSelf = nil; | ||
} failureBlock:^(NSError *error) { | ||
if (completionBlock) { | ||
completionBlock(assetURL, error); | ||
} | ||
weakSelf = nil; | ||
}]; | ||
} failureBlock:^(NSError *error) { | ||
if (completionBlock) { | ||
completionBlock(assetURL, error); | ||
} | ||
weakSelf = nil; | ||
}]; | ||
return; | ||
} | ||
} failureBlock:^(NSError *error) { | ||
if (completionBlock) { | ||
completionBlock(assetURL, error); | ||
} | ||
weakSelf = nil; | ||
}]; | ||
}]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// APanelViewController.h | ||
// PlayOPC | ||
// | ||
// Created by Hiroki Ishiura on 2015/04/25. | ||
// Copyright (c) 2015 Hiroki Ishiura. All rights reserved. | ||
// | ||
// Released under the MIT license | ||
// http://opensource.org/licenses/mit-license.php | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
/// カメラの撮影パラメータを変更します。 | ||
/// このビューコントローラーで操作できる撮影パラメータは、オートフォーカスと自動露出に関するものです。 | ||
@interface APanelViewController : UITableViewController | ||
|
||
/// ビューコントローラーが画面を表示して活動を開始する時に呼び出されます。 | ||
- (void)didStartActivity; | ||
/// ビューコントローラーが画面を破棄して活動を完了する時に呼び出されます。 | ||
- (void)didFinishActivity; | ||
|
||
@end |
Oops, something went wrong.