Super simple this is the an easy way of doing it. Just replace my imagNamed with you images and the selector is the new methods that were created. This is used for a custom camera by removing showsCameraControls = NO;
@interface yourClassName () {
UIImagePickerController *picker; //this calls the video/photo screen
UIButton *cameraFront, *cameraBack //front and back buttons
}
//in your UIImagePickerController
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
picker.showsCameraControls = NO;
[cameraFront setBackgroundImage:[UIImage imageNamed:@"camera_switch_logo"] forState:UIControlStateNormal];
UITapGestureRecognizer *camerafront = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(deviceModeFront:)];
[cameraFront addGestureRecognizer:camerafront];
[cameraBack setBackgroundImage:[UIImage imageNamed:@"camera_switch_logo2"] forState:UIControlStateNormal];
UITapGestureRecognizer *cameraback = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(deviceModeBack:)];
[cameraBack addGestureRecognizer:cameraback];
cameraBack.hidden = true;
//These are the new methods created as the selector for when image is pressed
- (IBAction)deviceModeFront:(id)sender {
[picker setCameraDevice:UIImagePickerControllerCameraDeviceFront];
cameraFront.hidden = true;
cameraBack.hidden = false;
}
- (IBAction)deviceModeBack:(id)sender {
[picker setCameraDevice:UIImagePickerControllerCameraDeviceRear];
cameraFront.hidden = false;
cameraBack.hidden = true;
}