Hello, 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 new job in this view controller .I implemented pushviewcontroller to go CreateJobPostViewController. There I need to add UIImagePickerController to choose the image. When i tap done button or choose an image from library it dismisses to JobPostingViewController. But it should go to the CreateJobPostViewController.
Any one please help me. Thanks in advance.
Code in JobPostingViewController
code in CreateJobPostViewController
Any one please help me. Thanks in advance.
Code in JobPostingViewController
Code:
@IBAction func openCreateJob(sender: AnyObject) {
let vc = self.storyboard?.instantiateViewControllerWithIdentifier("CreateJobPostViewController") as! CreateJobPostViewController
self.navigationController?.pushViewController(vc, animated: true)
}
code in CreateJobPostViewController
Code:
override func viewDidLoad() {
super.viewDidLoad()
imagePicker.delegate = self
}
//MARK:- IBActions
@IBAction func addImages(sender: AnyObject) {
imagePicker.allowsEditing = false
imagePicker.sourceType = .PhotoLibrary
presentViewController(imagePicker, animated: true, completion: nil)
}
// this for did finish picker view controller
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
picker.dismissViewControllerAnimated(true, completion: nil)
}
// for cancel picker view controller
func imagePickerControllerDidCancel(picker: UIImagePickerController!)
{
picker.dismissViewControllerAnimated(true, completion: nil)
}
Attachments
Last edited: