1

What's the best method of having the rear facing camera run when the app successfully launches?

I'd like my app to open with a modal view controller first that way the user can dismiss the camera if they do not wish to take a photo at that time.

Thanks!

EDIT:

I have figured this out... It's a lot easier than I was making it!

- (void)viewDidLoad
{
    self.UIPicker = [[UIImagePickerController alloc] init];
    self.UIPicker.delegate = self;
    self.UIPicker.sourceType = UIImagePickerControllerSourceTypeCamera;

    [self launchCamera];
}

- (void)launchCamera
{
    if([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear])
    {
        self.UIPicker.cameraDevice =  UIImagePickerControllerCameraDeviceRear;
        [self presentViewController:self.UIPicker animated:NO completion:nil];
    }
    else
    {
        self.UIPicker.cameraDevice =  UIImagePickerControllerCameraDeviceFront;
        [self presentViewController:self.UIPicker animated:NO completion:nil];
    }
}

// image picker delegate code here

Another question though:

I am using a custom overlay, but the native "shutter" graphic still shows. How can this be removed or hidden?

Thanks!

4

1 に答える 1

2

この以下の条件を使用してください

if([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear]) 
{
    imagePickerController.cameraDevice =  UIImagePickerControllerCameraDeviceRear;
}
else 
{
    imagePickerController.cameraDevice =  UIImagePickerControllerCameraDeviceFront;
}
于 2013-09-10T04:14:27.770 に答える