I've created an overlay view for a camera with two buttons, a take picture button and a switch camera button. Take picture should take the picture and switch camera should change the rear view and front view camera. Neither of the things work. I've made an app like this a few months ago, and everything worked fine. I have the same code, and I don't know why the buttons don't work anymore. Any input is appreciated! If code is necessary I'll be happy to put it up!
Here's some code:
These are the connected buttons:
-(IBAction)takePicture:(id)sender{
NSLog(@"Taken");
[self.picker takePicture]; //Picker is the UIImagePickerController
}
-(IBAction)switchCamera:(id)sender{
if (self.picker.cameraDevice == UIImagePickerControllerCameraDeviceRear) {
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
} else{
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
}
}
I've connected the custom .xib view as to @property (nonatomic) IBOutlet UIView *overlay