ImagePagingViewCell
class ImagePagingViewCell : UICollectionViewCell
A custom cell for the ImagePagingCollectionViewController
.
It present an image in full screen and the background turns black/white when the image is tapped. The user can
pinch or double-tap to zoom and then pan around within the zoomed-in view.
Todo
for dark mode, always keep the background black - just hide the nav bar-
The image to display full screen.
Declaration
Swift
var image: UIImage? { get set }
-
The view controller that gets notified if the cell is tapped.
Declaration
Swift
weak var delegate: PagingViewWasTappedDelegate?
-
The scroll view for zooming and panning.
Declaration
Swift
@IBOutlet var scrollView: UIScrollView!
-
The image view that holds the image.
Declaration
Swift
@IBOutlet var imageView: UIImageView!
-
The factor by which the view zooms in when double-tapped.
Declaration
Swift
var zoomFactor: CGFloat
-
A
Boolean
to track if the view cell has been turned black (or not)Todo
rename to not confuse with iOS 13 Dark ModeDeclaration
Swift
var isInBlackMode: Bool { get set }
-
Undocumented
Declaration
Swift
override init(frame: CGRect)
-
Undocumented
Declaration
Swift
required init?(coder aDecoder: NSCoder)
-
Configure the cell for a new image.
Todo
rename thisconfigureFor(image:animated:)
instead of having the VC edit the image and it being called indirectly Just a change in API, not actual function or style.Declaration
Swift
func configureForNewImage(animated: Bool = true)
-
Called when a user double-taps on an image to zoom in or out.
Todo
make privateDeclaration
Swift
@objc func doubleTapAction(_ gestureRecognizer: UIGestureRecognizer)
Parameters
gestureRecognizer
The gesture that called the function.
-
Called when a user single-taps on an image. Toggles the dark background and hiding of navigation bar.
Todo
make privateDeclaration
Swift
@objc func singleTapAction(_ gestureRecognizer: UIGestureRecognizer)
Parameters
gestureRecognizer
The gesture that called the function.
-
Undocumented
Declaration
Swift
func scrollViewDidZoom(_ scrollView: UIScrollView)
-
Undocumented
Declaration
Swift
func viewForZooming(in scrollView: UIScrollView) -> UIView?
-
Calculates the minimum zoom scale of the scroll view based on the size of the image and view frame.
Declaration
Swift
func setZoomScale()