-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
click on collection view image to show it full screen / double tap to…
… dismiss
- Loading branch information
1 parent
0933b38
commit 0987adf
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// PopVC.swift | ||
// pixel-city | ||
// | ||
// Created by Johnny Perdomo on 3/20/18. | ||
// Copyright © 2018 Johnny Perdomo. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class PopVC: UIViewController, UIGestureRecognizerDelegate { | ||
|
||
@IBOutlet weak var popImageView: UIImageView! | ||
|
||
var passedImage: UIImage! //the image that will be passed | ||
|
||
func initData(forImage image: UIImage) { //pass in an image to initialize this VC | ||
self.passedImage = image//the passed image will be the image | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
popImageView.image = passedImage //this will make the image of the popVC be the passed image | ||
addDoubleTap() | ||
} | ||
|
||
|
||
func addDoubleTap() { | ||
let doubleTap = UITapGestureRecognizer(target: self, action: #selector(screenWasDoubleTapped)) | ||
doubleTap.numberOfTapsRequired = 2 | ||
doubleTap.delegate = self | ||
view.addGestureRecognizer(doubleTap) | ||
} | ||
|
||
@objc func screenWasDoubleTapped() { | ||
dismiss(animated: true, completion: nil) //to dismiss the view controller | ||
} | ||
} |