09-13-2011, 03:45 PM
#1 (permalink )
Registered Member
Join Date: Mar 2010
Posts: 167
How to make this camera face front?
I have this code
Code:
- (IBAction)cam{
// Create image picker controller
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// Set source to the camera
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
// Delegate is self
imagePicker.delegate = self;
// Allow editing of image ?
imagePicker.allowsImageEditing = NO;
// Show image picker
[self presentModalViewController:imagePicker animated:YES];
}
I want it to start up using the front camera.
09-13-2011, 03:48 PM
#2 (permalink )
Reading the Documentation
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
Documentation is your friend:
Loading
> cameraDevice -- > UIImagePickerControllerCameraDeviceFront
09-13-2011, 03:48 PM
#3 (permalink )
Senior Member
iPhone Dev SDK Supporter
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
Quote:
Originally Posted by UIImagePicker Class Reference
UIImagePickerControllerSourceTypeCamera
Specifies the device’s built-in camera as the source for the image picker controller. Indicate the specific camera you want (front or rear, as available) by using the cameraDevice property .
Straight from the docs
09-13-2011, 04:03 PM
#4 (permalink )
Registered Member
Join Date: Mar 2010
Posts: 167
Tried:
cameraDevice = UIImagePickerControllerCameraDeviceFront;
and some others, but received sigbart error
09-13-2011, 04:03 PM
#5 (permalink )
Reading the Documentation
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
It should be
Code:
imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
And you need to be running on the device, not the simulator (which has no camera), and you need to be using a device with a front facing camera, and running iOS 4.0 or higher (as you can see in the docs)
09-13-2011, 04:07 PM
#6 (permalink )
Senior Member
iPhone Dev SDK Supporter
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
Right, you definitely need to check that all of the proper devices are available before trying to use them, as baja implied. Also was there any additional info with the SIGABRT?
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
» Advertisements
» Online Users: 408
15 members and 393 guests
7twenty7 , Eclectic , eski , EvilElf , fiftysixty , HemiMG , iOS.Lover , JackReidy , jarv , sacha1996 , teebee74 , tim0504 , UMAD , VinceYuan , yuncarl28
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,121
Posts: 402,905
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28