LoginSignup
2
2

More than 5 years have passed since last update.

写真ライブラリへのアクセス

Last updated at Posted at 2015-04-09

下記のようなソースだけで写真一覧が表示される。
ただしUINavigationControllerの影響下にあること。
普段あまりUINavigationController使わないので
はまりました。

スクリーンショット 2015-04-09 23.48.46.png

- (void)viewDidLoad {
 [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIImagePickerController* imagePickerController = [[UIImagePickerController  alloc] init];
    imagePickerController.delegate = self;
    imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentViewController:imagePickerController animated:YES completion:NULL];
}

一覧表示された写真を選択すると下記デリゲートメソッドが呼ばれる。
NSLogでアセットライブラリのパスが表示される。

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSLog(@"%@",info);
}
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2