I have so strange issue. I have parent VC named NewAdCreationViewController
it presents modally child VC named CollectionPicturesViewController
. In child VC I have link to the parent VC.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == picturesCollectionVCSegueName {
let collectionController = (segue.destination as! UINavigationController).viewControllers.first as! CollectionPicturesViewController
let cell = tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as? PicturesCollectionTableViewCell
guard cell != nil else{ return }
collectionController.picturesArray = cell!.itemPictures
collectionController.parentVC = self // this is link!
}
}
In child VC I present another VC for picking photos - DKImagePickerController
(pod). After picking all my photos appears in collectionView in child VC, and when I tap "Save" I want to pass all that data to parent VC and dismiss child,
@objc func savePictures(){
self.parentVC.pictures = self.picturesArray
self.parentVC.tableView.reloadData()
self.dismiss(animated: true, completion: nil)
}
but after I dismiss it my parent reloads completely and starts from viewDidLoad
. It presents completely new VC(I've checked in console, it has another address in memory). I really don't know why is that?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.