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 private

    Declaration

    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 private

    Declaration

    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
  • Respond to a pan gesture to dismiss the view controller. The zoom animation transition is initiated.

    Declaration

    Swift

    @objc
    func userDidPanWith(gestureRecognizer: UIPanGestureRecognizer)
  • 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.