简体   繁体   中英

How I could animate changing UIViewControllers?

I have a UIViewController based app and I want to changes data on view with animation (handle touchesbegan, touchesmove, touchesended ). All data I save in a base). For example, I have main screen, and when (touches ended) handles, I want to show other view. UiViewControllers图片

Whatever i will be to do, screens could be rotate (to right or to left, if position changes more then 1/2 of width View, but if labels count number more then count of rows in my table, I want to set state at image 2.

Could you see right way to do animations? For example, I could to create my own class or use app delegate, but I not sure from what I must to start.

Use UIView's transitionsWithView method:

[UIView transitionWithView:containerView
       duration:0.2
       options:UIViewAnimationOptionTransitionFlipFromLeft
       animations:^{ [fromView removeFromSuperview]; [containerView addSubview:toView]; }
       completion:NULL];

More details, including above example can be found here:

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816

Tim

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