presentModalViewController in landscape after portrait viewController

非 Y 不嫁゛ 提交于 2019-12-12 12:33:47

问题


I have a main viewController that is in portrait mode all the time.

I want then to presentModalViewController, but it will come from the left (not from bottom of the screen) in landscape.

Is it possible?

tnx


回答1:


In your modal view controller implementation, override -shouldAutorotateToInterfaceOrientation:

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



回答2:


I came across this problem too. So i just used the modaltransitionstyle so it didn't look to iffy.

Hope this helps.

viewController.modalTransitionStyle = *modaltransitionstyle*;

[self presentModalViewController:viewController animated:YES];


来源:https://stackoverflow.com/questions/1906280/presentmodalviewcontroller-in-landscape-after-portrait-viewcontroller

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