To run the example project, clone the repo, and run pod install
from the Example directory first.
BPPopCardTransition is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "BPPopCardTransition"
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)
}
- Make more generic.
bluepi0j, bluepi0j@gmail.com
BPPopCardTransition is available under the MIT license. See the LICENSE file for more info.