UIWindow中的多个视图 [英] Multiple views in a UIWindow

查看:170
本文介绍了UIWindow中的多个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个导航应用程序,它也需要有一个视图总是显示在屏幕的底部。在添加UINavigationController的视图后,我将这个新视图添加到UIWindow:

I have a "navigation based application" which also needs to have a view always displayed at the bottom of the screen at all times. I added this new view to a UIWindow after adding the UINavigationController's view:

// In my delegate's applicationDidFinishLaunching method
[window addSubview:navigationController.view];
[window insertSubview:disclaimerController.view aboveSubview:navigationController.view];
[window makeKeyAndVisible];

我添加的第二个视图不能正确旋转。它不会改变位置,并且它的视图控制器的旋转方法不会被调用。

This works fine except for rotation. The second view I added doesn't rotate correctly. It doesn't change position and it's view controller's rotate methods don't get called.

显然,我要走这个错误的方式。我的问题是,我如何在屏幕上的第二个视图,不是导航控制器的视图的一部分?感谢。

Obviously, I'm going about this the wrong way. My question is, how can I have a second view on screen that's not part of navigation controller's view? Thanks.

推荐答案

如果您要通过添加为另一个视图添加为子视图旋转不工作被通知旋转)。你可以做的是注册视图与设备通知旋转事件,然后你可以编程处理旋转(它不会为你做)。

If you are adding a view on top of another by adding as subview rotation will not work (view won't be notified of rotation). What you can do is register the view with the device to be notified of rotation events, then you can programatically handle rotation (it will not do it for you).

这篇关于UIWindow中的多个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆