Comments (2)
Hello, here's an example from my project, it works well in Swift 2 (except "supporting UIViewControllerInteractiveTransitioning" and "incorrect layout after dismissing view controller after rotating the screen").
You need to use as? protocol<RMPZoomTransitionAnimating, RMPZoomTransitionDelegate>
to replace the ObjC codes id <RMPZoomTransitionAnimating, RMPZoomTransitionDelegate>
.
You need to inherit both RMPZoomTransitionAnimating and RMPZoomTransitionDelegate to make sure animator.sourceTransition
and animator.destinationTransition
are not nil
.
// MARK: - UINavigationControllerDelegate
extension NewsViewController: UINavigationControllerDelegate {
func navigationController(navigationController: UINavigationController, animationControllerForOperation operation: UINavigationControllerOperation, fromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if fromVC is RMPZoomTransitionAnimating && toVC is RMPZoomTransitionAnimating {
let animator = RMPZoomTransitionAnimator()
animator.goingForward = (operation == .Push)
animator.sourceTransition = fromVC as? protocol<RMPZoomTransitionAnimating, RMPZoomTransitionDelegate>
animator.destinationTransition = toVC as? protocol<RMPZoomTransitionAnimating, RMPZoomTransitionDelegate>
return animator
} else {
return nil
}
}
}
// MARK: - RMPZoomTransitionAnimating/RMPZoomTransitionDelegate
extension NewsViewController: RMPZoomTransitionAnimating, RMPZoomTransitionDelegate {
func imageViewFrame() -> CGRect {
if let collectionView = self.collectionView(),
let indexPath = self.selectedIndexPath,
let cell = collectionView.cellForItemAtIndexPath(indexPath) as? NewsCollectionViewCell,
let imageView = cell.fgImageView {
let frame = imageView.convertRect(imageView.frame, toView: self.view.window)
return frame
}
return CGRectZero
}
func transitionSourceImageView() -> UIImageView! {
let imageView = UIImageView()
imageView.clipsToBounds = true
imageView.userInteractionEnabled = false
imageView.contentMode = .ScaleAspectFill
imageView.frame = imageViewFrame()
imageView.image = self.selectedNewsViewCell?.fgImageView!.image
return imageView
}
func transitionSourceBackgroundColor() -> UIColor! {
return UIColor.whiteColor()
}
func transitionDestinationImageViewFrame() -> CGRect {
return imageViewFrame()
}
func zoomTransitionAnimator(animator: RMPZoomTransitionAnimator!, didCompleteTransition didComplete: Bool, animatingSourceImageView imageView: UIImageView!) {
}
}
from rmpzoomtransitionanimator.
Hi, @iamsoheavy
Did you implement following methods?
- (UIImageView *)transitionSourceImageView;
- (UIColor *)transitionSourceBackgroundColor;
- (CGRect)transitionDestinationImageViewFrame;
If you show the example code to fail check protocol, I will support in detail.
from rmpzoomtransitionanimator.
Related Issues (16)
- Add support for UIViewControllerInteractiveTransitioning HOT 2
- Navigation Bar flashes white color HOT 1
- Swift Example HOT 3
- Top Layout Guide incorrect when coming back to original screen
- Problem when navigation bar is not translucent HOT 9
- import <RMPZoomTransitionAnimator/RMPZoomTransitionAnimator.h> not "RMPZoomTransitionAnimator.h"
- Transition breaks navigation controller HOT 2
- Copyright of LICENSE file mistakes.
- Unable to install - Please update the pod File. HOT 1
- Update Swift 4 HOT 4
- library not found for -lPods-RMPZoomTransitionAnimator HOT 1
- Navigation Bar is hidden/ disappears HOT 2
- iPad Example HOT 5
- [Enhancement] Callback on animation completions HOT 3
- call transitionDestinationImageViewFrame after UICollectionView reload data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rmpzoomtransitionanimator.