当为我的 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/