Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let images = self.storyboard?.instantiateViewController(withIdentifier:"Collection") as! UICollectionViewController
- self.navigationController?.pushViewController(images, animated: true)
- class ViewController: UIViewController {
- @IBOutlet weak var imageView: UIImageView!
- override func viewDidLoad() {
- super.viewDidLoad()
- }
- override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
- // showDetail Segue
- if segue.identifier == "showDetail" {
- // Sending the image to DetailViewController
- // Before appears in the screen.
- let detailViewController = segue.destination as! DetailViewController
- detailViewController.image = sender as? UIImage
- }
- }
- @IBAction func loginButton(_ sender: AnyObject) {
- // Go to another view controller
- performSegue(withIdentifier: "showDetail", sender: imageView.image)
- }
- }
- class DetailViewController: UIViewController {
- @IBOutlet weak var imageView: UIImageView!
- var image: UIImage?
- override func viewDidLoad() {
- super.viewDidLoad()
- if let imageSent = image {
- imageView.image = imageSent
- }
- }
- }
- let vc = self.storyboard?.instantiateViewController(withIdentifier: "UpdateFilesViewController")
- self.navigationController?.present(vc!, animated: true, completion: nil)
- self.navigationController?.pushViewController(images, animated: true)
- let images = self.storyboard?.instantiateViewController(withIdentifier:"Collection") as! UICollectionViewController
- self.present(images, animated: true, completion: nil)
Add Comment
Please, Sign In to add comment