gpt4 book ai didi

ios - UIImagePickerController照片快门无法打开

转载 作者:行者123 更新时间:2023-12-01 16:32:36 25 4
gpt4 key购买 nike

我正在开发仅支持横向的iPad应用

我想做的是,我想在单击按钮时打开照片库。
这是我的代码段,

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

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

,请提供帮助并感谢。

最佳答案

试试这个:

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];
}

关于ios - UIImagePickerController照片快门无法打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30999195/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com