gpt4 book ai didi

iphone - 在 iOS 上从横向 View 切换到纵向 View

转载 作者:行者123 更新时间:2023-11-29 13:26:52 28 4
gpt4 key购买 nike

我的应用程序中有两个 View 。一个(默认情况下)是横向。当用户单击某个菜单时,我需要显示纵向 View 。

我已准备好所有代码,我正在尝试使用它:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

return (interfaceOrientation == UIInterfaceOrientationPortrait);

}

但应用程序仍以横向显示下一个 View 。我想不通。任何帮助都会很棒。

最佳答案

You can not do it using navigation controller but if you are presenting your view then it  is possible to do that and make sure when you are presenting your view animation should be NO.
It works for me very well.

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

关于iphone - 在 iOS 上从横向 View 切换到纵向 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12907606/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com