ImagePagingCollectionViewController
class ImagePagingCollectionViewController : UICollectionViewController
A collection view that presents images in a horizontal paging view. Images can be edited (cropped).
-
The index to open to.
Declaration
Swift
var startingIndex: Int
-
The array of images to present.
Declaration
Swift
var images: [UIImage]
-
The index of the image currently being displayed to the user.
Declaration
Swift
var currentIndex: Int { get set }
-
Used to know if the image view of the current cell is hidden. This is required for a smooth transition from the parent image view collection. The image is hidden during the transition, and then un-hidden, afterwards.
Todo
make privateDeclaration
Swift
var hideCellImageViews: Bool
-
The controller for the zooming transition animation.
Declaration
Swift
var transitionController: ZoomTransitionController
-
Delegate to respond to changes in the image array
images: [UIImage]
.Declaration
Swift
var containerDelegate: ImagePagingCollectionViewControllerDelegate?
-
A delegate to respond to changes in a specific image in
images: [UIImage]
Declaration
Swift
var saveEditsDelegate: EditedImageDelegate?
-
Undocumented
Declaration
Swift
override func viewDidLoad()
-
Set up the collection view so it has a horizontal paging view. This is called during
viewDidLoad()
.Todo
make privateDeclaration
Swift
func setupCollectionView()
-
Undocumented
Declaration
Swift
override func numberOfSections(in collectionView: UICollectionView) -> Int
-
Undocumented
Declaration
Swift
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
-
Undocumented
Declaration
Swift
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
-
Undocumented
Declaration
Swift
override func scrollViewDidScroll(_ scrollView: UIScrollView)
-
Undocumented
Declaration
Swift
override func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
-
Undocumented
Declaration
Swift
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize
-
Undocumented
Declaration
Swift
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat
-
Undocumented
Declaration
Swift
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat
-
Declaration
Swift
func transitionWillStartWith(zoomAnimator: ZoomAnimator)
-
Declaration
Swift
func transitionDidEndWith(zoomAnimator: ZoomAnimator)
-
Declaration
Swift
func referenceImageView(for zoomAnimator: ZoomAnimator) -> UIImageView?
-
Declaration
Swift
func referenceImageViewFrameInTransitioningView(for zoomAnimator: ZoomAnimator) -> CGRect?
-
Respond to a pan gesture to dismiss the view controller. The zoom animation transition is initiated.
Declaration
Swift
@objc func userDidPanWith(gestureRecognizer: UIPanGestureRecognizer)
-
Turn the cell background black or white when a user taps on the cell
Todo
this will need a creative solution for iOS 13 Dark ModeDeclaration
Swift
func pagingViewCell(_ pagingViewCell: ImagePagingViewCell, shouldBeTurnedBlack: Bool)
-
Responds to a user tappinng the Edit button the navigation bar. The options are to Edit, Share, make the header image of the
Plant
object, or Delete the image. Each of those options has a specific handler function.Declaration
Swift
@objc func tappedActionButton()
-
Edit a photo using a
CropViewController
.Note
The
CropViewController
is from the swift package ‘TOCropViewController’.Todo
make private
Declaration
Swift
func editPhoto(_ alert: UIAlertAction)
Parameters
alert
The alert action that called the function.
-
Share an image using the standard
UIActivityViewController
.Todo
make private
Declaration
Swift
func shareImage(_ alert: UIAlertAction)
Parameters
alert
The alert action that called the function.
-
Set the header image of the plant by calling
EditedImageDelegate.setProfileAs(imageAt:)
Todo
make private
Declaration
Swift
func setHeaderImage(_ alert: UIAlertAction)
Parameters
alert
The alert action that called the function.
-
Delete the current image. This requires the image be deleted from this collection view, the parent collection view, the
Plant
object’s image array and from disk. All but the first of these tasks are completed by delegates.Todo
make private
Declaration
Swift
func deleteImageTapped(_ alert: UIAlertAction)
Parameters
alert
The alert action that called the function.
-
Undocumented
Declaration
Swift
func cropViewController(_ cropViewController: CropViewController, didFinishCancelled cancelled: Bool)
-
Undocumented
Declaration
Swift
func cropViewController(_ cropViewController: CropViewController, didCropToImage image: UIImage, withRect cropRect: CGRect, angle: Int)