我想要做的是让相机作为第一个屏幕打开应用程序。它不起作用,我不知道我失踪了什么。如果有人能填补我这将是美好的...谢谢。
- (void)viewDidLoad
{
[super viewDidLoad];
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
}
else
{
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
}
答案 0 :(得分:3)
试试这样。希望它可以帮到你:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
[self presentViewController:imagePicker animated:YES completion:nil];