iOS 7中的UIImagePickerControllerSourceTypePhotoLibrary不起作用

时间:2013-10-02 07:47:46

标签: iphone objective-c ios7

当我升级到iOS7时,当我从应用程序访问照片库时,我的应用程序显示一个空的视图控制器。它正在使用较旧的框架。

 UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
    imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePickerController.delegate = self;
    self.imagePicker = imagePickerController;
    //self.imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentViewController:self.imagePicker animated:YES completion:nil];

1 个答案:

答案 0 :(得分:0)

请直接申请此代码

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.delegate = self;
[self presentViewController:imagePickerController animated:YES completion:nil];

当此代码运行时“应用程序”想要访问您的照片消息,当您单击确定然后将显示所有图像

感谢。