Flip View Iphone

僤鯓⒐⒋嵵緔 提交于 2019-11-27 06:42:21

It's probably because you aren't using a container view as the transition view. Refer to the documentation on setAnimationTransition:forView:cache:

If you want to change the appearance of a view during a transition—for example, flip from one view to another—then use a container view, an instance of UIView, as follows:

  1. Begin an animation block.
  2. Set the transition on the container view.
  3. Remove the subview from the container view.
  4. Add the new subview to the container view.
  5. Commit the animation block.

Try using self.view.superview in the animation transition view of the showMoreInfo:

The reason the showLessInfo: method works is you are using a container view.

Can you use your MainWindow (UIWindow) as the container view as UIWindow inherence from UIView?

Also iPhone 3.0 introduced the flip transaction via the presentModalViewController method:

CustomViewController *vc = [[CustomViewController alloc]
    initWithNibName:@"CustomViewController" bundle:nil];

vc.delegate = self;

// The magic statement. This will flip from right to left.
// present the modal view controller then when you dismissModalViewController
// it will transition flip from left to right. Simple and elegant.
vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

[self presentModalViewController:vc animated:YES];

[vc release];

After iOS 4.0, you can flip between views with this:

[UIView transitionFromView:sourceView toView:destinationView duration:0.35f options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) {
    NSLog(@"I just flipped!");
}];

As Jason mentioned, you'll need this to occur within a container view.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!