简体   繁体   中英

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?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM