UIView Animation: PartialCurl …bug during rotate?

眉间皱痕 提交于 2019-12-12 04:23:46

问题


a short question.

I've created an app for the iPad, much like a utility app for the iPhone (one mainView, one flipSideView). The animation between them is UIModalTransitionStylePartialCurl. shouldAutorotateToInterfaceOrientation is returning YES.

If I rotate the device BEFORE entering the FlipSide, everything is okay and the PartialCurl is displayed okay. But if I enter the FlipSide and then rotate the device, while the UIElements do rotate and position themselves just fine, the actual "page curl" stays with its initial orientation. it just won't budge :)

Is it a known issue? am I doing something wrong? Thanks!


回答1:


I too had this issue and somewhat gave up. However, I mentioned my dilemma to a friend, who encouraged me to look into the child VC's logic and I recalled a handy trick that I've used to pass data between parent/child view controllers.

In your flipside view controller, create a "rootViewController" property. In your parent view controller, when you initialize the flipside view controller, you set (where "self" is the rootVC):

flipsideController.rootViewController = self;

You then use this for your flipside VC's shouldAutorotateToInterfaceOrientation method:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return interfaceOrientation == self.rootViewController.interfaceOrientation;
}

Viola! The flipside view no longer rotates underneath the partially curled up parent view!




回答2:


The shortest way of the above code is:

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return interfaceOrientation == self.parentViewController.interfaceOrientation;
}


来源:https://stackoverflow.com/questions/2644782/uiview-animation-partialcurl-bug-during-rotate

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