I am working on a project that uses tabbar system. One of the item of tabbar is JobPostingViewController. I Embed it in UINavigationController. There is a UIButton called add ne
You could use:
picker.modalPresentationStyle = .overCurrentContext
but depending on your screen layout, it may be better to use:
picker.modalPresentationStyle = .overFullScreen
otherwise your "cancel", "retake" and "use photo" buttons may not be visible.
I had this same problem, I solved it using the storyboard (Xcode v9.2)
1 - Go to the storyboard, where is your ViewController, select it
2 - Set Presentation as: Current Context
Note: If it does not work Current Context, select Over Current Context
Adding Picker as subview
try to add the imagepicker as a subview to your CreateJobPostViewController insted of presenting it and then remove it from parent in the delegtes
@IBAction func openCreateJob(sender: AnyObject) {
var picker: UIImagePickerController = UIImagePickerController()
picker.delegate = self
picker.allowsEditing = false
picker.sourceType = .PhotoLibrary
self.addChildViewController(picker)
picker.didMoveToParentViewController(self)
self.view!.addSubview(picker.view!)
}
and then
func imagePickerControllerDidCancel(picker: UIImagePickerController) {
picker.view!.removeFromSuperview()
picker.removeFromParentViewController()
}
For presenting
showing picker over currentcontext with options like edit cancel choose,
use picker.modalPresentationStyle = .overCurrentContext
//before presenting
it
presentViewController(picker, animated: true, completion: nil)
Fixed the issue by setting the image picker's modalPresentationStyle to "OverCurrentContext":
picker.modalPresentationStyle = .overCurrentContext