ios - 打开我的相机时,它首先显示黑色 - Objective C

标签 ios objective-c

当为我的 ViewController 打开相机功能时,屏幕有时会在有限的时间内显示为黑色,我不确定为什么?

这是我正在做的:

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor clearColor];
    [self startCamera];
    [self performSegueWithIdentifier:@"moveToHome" sender:self];
}
-(void)startCamera
{
    UIImagePickerController *imagePicker = [[UIImagePickerController

                                             alloc] init];
    imagePicker.sourceType =  UIImagePickerControllerSourceTypeCamera;
    imagePicker.mediaTypes =  [NSArray arrayWithObject:(NSString *)

                               kUTTypeMovie];
    imagePicker.delegate = self;
    //UISaveVideoAtPath
    imagePicker.allowsImageEditing = NO;
    imagePicker.videoMaximumDuration = 10.0f; // limits video length to 30 seconds.
    [self.view addSubview:imagePicker.view];
    [imagePicker viewWillAppear:YES];
    [self presentModalViewController:imagePicker animated:YES]; 
}

建议、想法?

最佳答案

你没有告诉它消耗了多少时间。

如果它出现几秒钟,那不是问题。
因为相机需要先加载,然后它会来供您使用所有功能。
这是每次都会发生的默认情况。

您甚至可以在默认的相机应用程序中检查这个东西。

关于ios - 打开我的相机时,它首先显示黑色 - Objective C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23166815/

相关文章:

ios - 滚动加载新图像时,表格 View 急剧移动

iphone - 在委托(delegate)方法中访问单元格的属性

ios - 从 NSArray 分配给 NSMutableString 的不兼容指针类型

ios - iOS5.1 中的位置服务无法正常工作

ios - 如何将警报弹出 View 与自定义警报弹出 View 切换?

ios - UIPanGestureRecognizer 更新间隔

ios - 如何在 iOS Swift 3 中使用 guard 和 condition?

ios - Flutter - Firebase 云消息传递,iOS 上未收到数据消息

swift - Swift init 能否仅适用于 Objective C?

iphone - 如何在 UIImageView 中显示高分辨率图像