UIImagePickerController照片快门无法打开

时间:2015-06-23 09:39:09

标签: ios iphone ipad uiimage photos

我正在开发支持仅景观的iPad应用程序

我想要做的是,我想点击按钮打开照片库。 这是我的代码段,

UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.modalPresentationStyle = UIModalPresentationCurrentContext;

当我写这篇文章时它没有打开照片库:( 我不知道我在哪里做错了

请提供帮助和感谢。

1 个答案:

答案 0 :(得分:0)

试试这个:

UIImagePickerController *picker=[[UIImagePickerController alloc]init];
picker.delegate=self;
picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;

if([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0)
{
    [[NSOperationQueue mainQueue] addOperationWithBlock:^{
        [self presentViewController:picker animated:NO completion:nil];
    }];
}else{
    [self presentViewController:picker animated:YES completion:nil];
}