nfoggia
nfoggia

Reputation: 513

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


}

Upvotes: 1

Views: 396

Answers (1)

Vishal
Vishal

Reputation: 8256

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

Upvotes: 3

Related Questions