iPhone卷曲左和卷曲右过渡 [英] iPhone Curl Left and Curl Right transitions

查看:211
本文介绍了iPhone卷曲左和卷曲右过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种在iPhone上执行 UIViewAnimationTransitionCurlUp UIViewAnimationTransitionCurlDown 的方法,底部,从左到右(或横向模式下的顶部/底部)。我看到这个问题aroud互联网几次,但没有sems得到一个答案。但我觉得这是可行的。

I am looking for a way to do a UIViewAnimationTransitionCurlUp or UIViewAnimationTransitionCurlDown transition on the iPhone but instead of top to bottom, do it from the left to right (or top/bottom in landscape mode). I've seen this asked aroud the internet a few times but none sems to get an answer. However I feel this is doable.

我试图改变View的transform和view.layer的transform,但这并不影响转换。因为当设备改变方向时,转换改变,我认为有一种方法愚弄设备以纵向模式使用横向转换,反之亦然?

I have tried changing the View's transform and the view.layer's transform but that didn't affect the transition. Since the transition changes when the device changes orientation I presume there is a way to fool the device to use the landscape transition in portrait mode and vice versa?

推荐答案

我实际上设法通过改变UIViewController的方向来实现这个效果。奇怪的是,我有控制器嵌套在另一个,当它不工作,但当我设置为立即视图控制器,它工作。

I actually managed to achieve this effect by changing the orientation of my UIViewController. The strange thing is, I had my controller nesten in another one when it wasn't working, but when I set him as the immediate view controller, it worked.

代码:

在UIViewController中,它是我应用程序代理中的主视图控制器,只允许横向第二个方法)我有以下:

In a UIViewController that is the main view controller in my app delegate and only allows landscape orientation (as you see in the 2nd method below) I have the following:

-(void)goToPage:(int)page flipUp:(BOOL)flipUp {

     //do stuff...

     // start the animated transition
     [UIView beginAnimations:@"page transition" context:nil];
     [UIView setAnimationDuration:1.0];
     [UIView setAnimationTransition:flipUp ? UIViewAnimationTransitionCurlUp : UIViewAnimationTransitionCurlDown forView:self.view cache:YES];

     //insert your new subview
     //[self.view insertSubview:currentPage.view atIndex:self.view.subviews.count];

      // commit the transition animation
      [UIView commitAnimations];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

这篇关于iPhone卷曲左和卷曲右过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆