在应用程序启动时打开相机视图(iOS6的)(Open camera view upon app St

2019-08-03 05:24发布

什么即时试图做的是有应用程序打开了相机的第一个屏幕。 它不工作,我不知道失去了什么IM。 如果任何人都可以填补我那是最好不过...谢谢。

    - (void)viewDidLoad
{


[super viewDidLoad];
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
    [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
}
else
{
    [imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}


}

Answer 1:

尝试这样的。 希望它可以帮助你:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;

imagePicker.delegate = self;

[self presentViewController:imagePicker animated:YES completion:nil];


文章来源: Open camera view upon app Startup (iOS6)