How to make UIViewAnimationTransitionCurlUp in rev

2019-07-21 10:38发布

问题:

I'm working on the app which allows flipping of the interface under some circumstances. Both landscape orientation should be supported (landscape left and right). Device flipping and orientation changes works fine, however, when in landscape mode, application allows to go to another screen using UIViewAnimationTransitionCurlUp effect and then back with UIViewAnimationTransitionCurlDown.

This works fine when orientation is landscape left (curl page up from the left bottom corner and then back). But when in landscape right orientation, coordinates are reversed - the bottom left corner is actually upper right in that case, so animation transition effect is reversed too, which is not desired behavior.

Is there some way how to transform this kind of animation so it appears the same in both orientations or some way how to create this effect "manually" (perhaps using Core Animation?).

Thanks for any tip on this.

回答1:

The transition direction is always set according to the Home button, that is, in each orientation the up/down/right/left is measured according to the Home button. If you want to have the transition direction in one direction according to the device orientation, you must use conditions to declare the direction for each of orientations:

  UIDeviceOrientation currentOrientation = [[UIDevice currentDevice] orientation];


if (UIDeviceOrientationIsPortrait(currentOrientation))
{

}

else if (UIDeviceOrientationIsLandscape(currentOrientation))
{

}

This of course includes two orientations only. You need to work more on this if you want individual transition styles for each four orientations.

P.S. JUST A LATE ANSWER! :-/