在UIDeviceOrientationLandscapeLeft和UIDeviceOrientationLandscapeRight中实现相同的页面转换

时间:2012-12-19 11:27:03

标签: ios uiinterfaceorientation uiviewanimationtransition page-curl uideviceorientation

我在iOS 6.0 sdk中开发项目应该适用于iOS4.3 +设备,在我的项目中我使用页面卷曲来浏览页面,但是LandscapeLeft中发生的页面卷曲与景观中的Pagecurl不同对。我希望在Landscape Left中发生的同一页面卷曲处于横向右侧。
请查看链接以便更好地理解。 Video Demo Link

我使用的代码如下所示

    -(IBAction)nextBtnTapped {

    UIDeviceOrientation deviceOrientation=[UIDevice currentDevice].orientation;

    page2 *Obj=[[page2 alloc]init];

    [UIView beginAnimations:nil context:NULL];

    [UIView setAnimationDuration:1];

    if (deviceOrientation==UIDeviceOrientationLandscapeLeft) 

        [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];

    else if(deviceOrientation==UIDeviceOrientationLandscapeRight) 

        [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO];

    [self.navigationController pushViewController:Obj animated:NO];

    [UIView commitAnimations];
}


-(IBAction)prevBtnTapped {

    UIDeviceOrientation deviceOrientation=[UIDevice currentDevice].orientation;

    [UIView beginAnimations:nil context:NULL];

    [UIView setAnimationDuration:0.8];

    if (deviceOrientation==UIDeviceOrientationLandscapeLeft) 

        [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO];

    else if(deviceOrientation==UIDeviceOrientationLandscapeRight) 

        [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];

    [self.navigationController popViewControllerAnimated:YES];

    [UIView commitAnimations];
}

任何人都可以告诉我在这段代码中做了什么错。 任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

有页面卷曲的

UIDeviceOrientationLandscapeLeft被窃听。你不会让它正常工作。