don
don

Reputation: 45

iOS subview custom transition

When presenting a UIViewController that implements UIViewControllerTransitioningDelegate it is easily possible to customize the viewtransition.

Now I would like to know if I can customize a viewtransition for a subview? Lets say I have a tapable tile that currently flips when tapped (UIViewAnimationOptionTransitionFlipFromRight). Although that is a very nice effect I rather would like to customize this transition. But I do not know how to start..

To clarify I would like to use an AnimationController<UIViewControllerAnimatedTransitioning> to handle my subviewtransition - is that possible?

Any suggestions?

Upvotes: 3

Views: 862

Answers (2)

nils
nils

Reputation: 1668

Well this is not possible out of the box but there are some ways to achieve that but this will need some deeper knowledge of how the custom transition are working in detail.

Here are two articles describing what you are looking for in detail:

Custom Container View Controller Transitions
http://www.objc.io/issue-12/custom-container-view-controller-transitions.html

Interactive Custom Container View Controller Transitions
http://www.iosnomad.com/blog/2014/5/12/interactive-custom-container-view-controller-transitions

Upvotes: 1

Losiowaty
Losiowaty

Reputation: 8006

Answering with regards to your comment : you cannot.

From UIViewControllerAnimatedTransitioning protocol documentation :

Adopt the UIViewControllerAnimatedTransitioning protocol in objects that implement the animations for a custom view controller transition. The methods in this protocol let you define an animator object, which creates the animations for transitioning a view controller on or off screen in a fixed amount of time.

This protocol is only for UIViewControllers (and its descendants), and UIView doesn't inherit from it.

Upvotes: 1

Related Questions