简体   繁体   中英

Do you know how to toss imageview into other view in swift?

I have a UICollectionView with UICollectionViewCell s. The collection view cells contain one UIImageView each. When the user taps on one of the cells I want to show the same image in another view. How can I pass the image into the next view?

simple, just pass it whenever you make an route to second controller

.........
let vc2: <#your controller#> = <#your controller#>()
vc2.image = self.image
vc1.show(vc2)
// or make your router
..........

and retreive your image variable

.......
self.imageView.image = self.image
......

you may need to declare an variable first in vc2, then you can toss it to next ViewController

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM