开发者

UIView not displaying in landscape

开发者 https://www.devze.com 2023-01-15 13:07 出处:网络
I have a window with a UIView and a transition to another UIView. But when I do the transition, the window to transition to is displayed in portrait, and after the transition is finished, it goes to l

I have a window with a UIView and a transition to another UIView. But when I do the transition, the window to transition to is displayed in portrait, and after the transition is finished, it goes to landscape.. But I want the UIView to be in landscape BEFORE the transition because otherwise the screen looks f*cked up because the background image is made for landscape mode. Here is my code:

UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:YES];

[[oldView view] removeFromSuperview];
[window addSubview:newView.view];

[UIView commitAnimations];

The orientation property of the newWindow is set to landscape in the interface builder, and also in the superview...

What am I doing wrong??

Thanks in adv开发者_如何学编程ance!


First of all, you should not use multiple window, it will never give you the result you are expecting... You can easily do the same thing with one window and 2 UIViews.


Solved... I had to put the commitAnimations part above the addSubview:newView

Hope this helps everyone with the same issue....

0

精彩评论

暂无评论...
验证码 换一张
取 消