Open camera view upon app Startup (iOS6)

感情迁移 提交于 2019-12-02 07:58:42

问题


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];
}


}

回答1:


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];


来源:https://stackoverflow.com/questions/13576357/open-camera-view-upon-app-startup-ios6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!