Skip to content

bluepi0j/BPPopCardTransition

Repository files navigation

BPPopCardTransition

Version License Platform

Overview

Overview

Overview

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

BPPopCardTransition is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "BPPopCardTransition"

Usage

Add BPPopCardAnimtionDelegate

class ViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, BPPopCardAnimtionDelegate
let transitionDelegate:BPPopCardTransitionsDelegate = BPPopCardTransitionsDelegate()
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {

    let cell: ImageCollectionViewCell = collectionView.cellForItem(at: indexPath)! as! ImageCollectionViewCell

    selectedCellFrame = collectionView.convert(cell.frame, to: self.view)
    selectedCellImageView = cell.cellImageView


    let popCardViewController: PopCardViewController = self.storyboard?.instantiateViewController(withIdentifier: "PopCardViewController") as! PopCardViewController

    transitionDelegate.delegate = self

    popCardViewController.transitioningDelegate = transitionDelegate
    popCardViewController.bannerImage = self.selectedCellImageView!.image
    popCardViewController.modalPresentationStyle = .custom
    self.present(popCardViewController, animated: true, completion: nil)

}
// MARK: - BPPopCardAnimtionDelegate
func rectZoomPosition() -> CGRect {
    return selectedCellFrame!
}

func cellImageView() -> UIImageView {
    return selectedCellImageView!
}

func popCardViewBannerHeight() -> CGFloat {
    return CGFloat(267)
}

TODO

  • Make more generic.

Author

bluepi0j, bluepi0j@gmail.com

License

BPPopCardTransition is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published