Guest User

Untitled

a guest
Jan 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. let images = self.storyboard?.instantiateViewController(withIdentifier:"Collection") as! UICollectionViewController
  2. self.navigationController?.pushViewController(images, animated: true)
  3.  
  4. class ViewController: UIViewController {
  5.  
  6. @IBOutlet weak var imageView: UIImageView!
  7.  
  8. override func viewDidLoad() {
  9. super.viewDidLoad()
  10. }
  11.  
  12. override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  13.  
  14. // showDetail Segue
  15. if segue.identifier == "showDetail" {
  16. // Sending the image to DetailViewController
  17. // Before appears in the screen.
  18. let detailViewController = segue.destination as! DetailViewController
  19. detailViewController.image = sender as? UIImage
  20. }
  21.  
  22. }
  23.  
  24. @IBAction func loginButton(_ sender: AnyObject) {
  25.  
  26. // Go to another view controller
  27. performSegue(withIdentifier: "showDetail", sender: imageView.image)
  28.  
  29. }
  30.  
  31. }
  32.  
  33. class DetailViewController: UIViewController {
  34. @IBOutlet weak var imageView: UIImageView!
  35. var image: UIImage?
  36.  
  37. override func viewDidLoad() {
  38. super.viewDidLoad()
  39.  
  40. if let imageSent = image {
  41. imageView.image = imageSent
  42. }
  43. }
  44. }
  45.  
  46. let vc = self.storyboard?.instantiateViewController(withIdentifier: "UpdateFilesViewController")
  47. self.navigationController?.present(vc!, animated: true, completion: nil)
  48.  
  49. self.navigationController?.pushViewController(images, animated: true)
  50.  
  51. let images = self.storyboard?.instantiateViewController(withIdentifier:"Collection") as! UICollectionViewController
  52.  
  53. self.present(images, animated: true, completion: nil)
Add Comment
Please, Sign In to add comment