Search code examples
iosswiftuiimageuipopovercontroller

How can I get a image from popover and show it in the view controller


I've a popOver with some images and when I touch in one of then I'd like to get this image and show this image in viewController.

The app is basically the viewController with the button witch call the popOver with the images.

Any suggestion ?

sorry about the english.


Solution

  • I guess your popover is also a view controller and you must be having paths for all the images displayed in that view controller. Additionally you must be displaying those images either in a tableView or collectionView. So what you can do is just get the path of your image and then pass this image path back to your original viewcontroller. There in your main view controller you can get the image with the help of the path. One problem you might face is passing this image back to the main view controller for which you can search "passing data between viewcontrollers". There are real good answers to that question.