尝试在 iOS 中创建有问题的弹出视图
我正在制作一个小型应用程序,并且想要一个小的弹出窗口。我当前拥有的是当用户启动应用程序时显示的启动屏幕,然后我将其加载到主屏幕中。目前,主屏幕看起来与启动屏幕完全相同,但几秒钟后,我希望出现一个带有菜单布局(标签、按钮等)的弹出窗口。我创建了一个自定义 UIViewController,上面有一个视图、一个标签和一个按钮。然后,我有以下代码来调用弹出窗口:
// Create our popup window
LoginPopupView *popup = [[[LoginPopupView alloc] init] autorelease];
[self presentModalViewController:popup animated:YES];
这会导致我的主屏幕旋转其后面的背景,并使弹出窗口填充全屏,而控件也位于侧面。两个视图都设置为横向模式,除了此代码片段之外,一切都加载正常。只有在我添加此代码之后,所有内容都是横向的(注释掉该代码片段会使视图恢复正常)。
非常感谢任何帮助。
I am making a small application and would like a small popup to come in. What I currently have is the launch screen that displays when the user starts the application to which then I load in the home screen. At the moment the home screen looks exactly like the splash screen, but after a few seconds I would like a popup to appear with a menu layout (labels, buttons, etc.). I created a custom UIViewController with a view, a label, and a button on it. I then have the following code to call the popup:
// Create our popup window
LoginPopupView *popup = [[[LoginPopupView alloc] init] autorelease];
[self presentModalViewController:popup animated:YES];
This causes my home screen to rotate the background behind it and have the popup fill the fullscreen while the controls are also sideways. Both views are set to landscape mode and aside from this code snippet everything loads fine. It's only after I added in this code that everything is sideways (commenting out the snippet returns the view back to normal).
Any help is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能否检查
LoginPopupView
中的shouldAutorotateToInterfaceOrientation:
实现,并确保它返回的值与您希望视图的显示方式一致?在模态视图控制器
viewWillAppear
中,执行:这可以修复模态视图控制器在旋转时可能存在的额外问题。
Could you check
shouldAutorotateToInterfaceOrientation:
implementation inLoginPopupView
and make sure that it returns a value coherent with how you would like the view to be displayed?In your modal view controller
viewWillAppear
, execute:this could fix an additional quirk that modal view controller may have with rotating.