相机UIImagePickerController在设备ios8中显示黑屏 [英] camera UIImagePickerController shows black screen in device ios8

查看:90
本文介绍了相机UIImagePickerController在设备ios8中显示黑屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试下面的代码来通过相机捕获图像。此代码在iPhone 6以下的所有设备中都能正常工作
此代码在iPHone6和iPhone6 +中不起作用。它显示黑屏。

I am try below code to capture Image through camera. This code is working fine in all device below the iPhone 6 This code is not working in iPHone6 and iPhone6+. It show a black screen.

enter code here

 (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;

    switch (buttonIndex)
    {
        case 0: NSLog(@"Photo Butten Clicked");
            picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            [App_Delegate.window.rootViewController presentViewController:picker animated:YES completion:nil];
            //            [self presentViewController:picker animated:YES completion:NULL];
            break;

        case 1: NSLog(@"Camera Butten Clicked");
            picker.sourceType = UIImagePickerControllerSourceTypeCamera;
             [App_Delegate.window.rootViewController presentViewController:picker animated:YES completion:nil];
            // [self presentViewController:picker animated:YES completion:NULL];
            break;

        default:
            break;
    }
}


推荐答案

我得到解决方案我只需在代码下面替换

I got solution. I just replace below code

[App_Delegate.window.rootViewController 
        presentViewController:picker 
        animated:YES 
        completion:nil];

此代码

[self presentViewController:picker animated:YES completion:NULL];

这篇关于相机UIImagePickerController在设备ios8中显示黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆