简体   繁体   English

应用程序启动时打开相机视图(iOS6)

[英]Open camera view upon app Startup (iOS6)

what im trying to do is to have the app open up with the camera as the first screen. 我想要做的是让相机作为第一个屏幕打开应用程序。 It isn't working and i don't know what im missing. 它不起作用,我不知道我失踪了什么。 If anyone can fill me in that would be wonderful... Thanks. 如果有人能填补我这将是美好的...谢谢。

    - (void)viewDidLoad
{


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

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


}

Try like that. 试试这样。 Hope it helps you: 希望它可以帮助你:

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

imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;

imagePicker.delegate = self;

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM