首页 > 代码库 > ios调用摄像头默认为摄像
ios调用摄像头默认为摄像
if(![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"错误提示" message:@"没有发现摄像头" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
[alert show];
return;
}
UIImagePickerController *pickerVideo = [[UIImagePickerController alloc] init];
pickerVideo.sourceType = UIImagePickerControllerSourceTypeCamera;
pickerVideo.delegate = self;
pickerVideo.allowsEditing = YES;
pickerVideo.videoQuality = 2;
pickerVideo.videoMaximumDuration = 60.0f;
pickerVideo.cameraDevice = UIImagePickerControllerCameraDeviceFront;
pickerVideo.mediaTypes = [NSArray arrayWithObject:@"public.movie"];
[self presentViewController:pickerVideo animated:YES completion:nil];
ios调用摄像头默认为摄像