Created
March 6, 2014 04:48
-
-
Save ken0nek/9382855 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // フォトライブラリを開く | |
| -(IBAction)openLibrary{ | |
| // 画像の取得先をフォトライブラリに設定 | |
| UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypePhotoLibrary; | |
| // フォトライブラリを使用可能かどうか判定する | |
| if ([UIImagePickerController isSourceTypeAvailable:sourceType]) { | |
| // UIImagePickerControllerを初期化・生成 | |
| UIImagePickerController *picker = [[UIImagePickerController alloc] init]; | |
| // 画像の取得先をフォトライブラリに設定 | |
| picker.sourceType = sourceType; | |
| // デリゲートを設定 | |
| picker.delegate = self; | |
| // フォトライブラリをモーダルビューとして表示する | |
| [self presentViewController:picker animated:YES completion:nil]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment