0

I am doing one application. In that I am using the camera to take the pictures from rear camera only. So I want to disable the camera switch button(rear to front and front to rear). So please guide me how to do this?

Rajan Balana
  • 3,775
  • 25
  • 42
  • 4
    Possible duplicate of [UIImagePickerController how to hide the flip camera button?](http://stackoverflow.com/questions/9525736/uiimagepickercontroller-how-to-hide-the-flip-camera-button) – Rajan Balana Nov 10 '16 at 05:13

1 Answers1

1

In objective-c

picker.cameraDevice=UIImagePickerControllerCameraDeviceRear;

In swift (I used 2.3)

picker.cameraDevice=UIImagePickerControllerCameraDevice.Rear
imagePicker.cameraOverlayView = UIView(frame: CGRectMake(0,0,screenSize.width,40))
        imagePicker.cameraOverlayView?.backgroundColor = UIColor.blackColor()
  • If i turn to landscape mode,on that time again flip button is appearing,And my app supports portrait only – Venkata Naresh Nov 10 '16 at 08:53
  • This link might help with camera orientations http://stackoverflow.com/a/14812010/5409618 If you can know that the orientation is landscape, you can change the code as: imagePicker.cameraOverlayView = UIView(frame: CGRectMake(screenSize.width - 40,0,40,screenSize.height)) – Hrishikesh Menon Nov 11 '16 at 07:30