Does anyone know how to enable the photo album button on the UIImagePickerController when its in the camera mode? Like how the camera app on on the iphone can toggle between ima
Swift2 version of @epsilontik code:
//mediaPicker is your UIImagePickerController
func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) {
if(mediaPicker.sourceType == UIImagePickerControllerSourceType.PhotoLibrary){
let button = UIBarButtonItem(title: "Take picture", style: UIBarButtonItemStyle.Plain, target: self, action: "showCamera")
viewController.navigationItem.rightBarButtonItem = button
}else{
let button = UIBarButtonItem(title: "Choose picture", style: UIBarButtonItemStyle.Plain, target: self, action: "choosePicture")
viewController.navigationItem.rightBarButtonItem = button
viewController.navigationController?.navigationBarHidden = false
viewController.navigationController?.navigationBar.translucent = true
}
}
func showCamera(){
mediaPicker.sourceType = UIImagePickerControllerSourceType.Camera
}
func choosePicture(){
mediaPicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
}