iPhone,一个iPhone应用程序中的多个uiwindows

发布于 2024-10-19 08:51:56 字数 370 浏览 10 评论 0原文

你好 我是一个 iPhone 新手,所以对 UIWindow 的概念有点困惑。我猜想,在 Mac 上,我们可以在一个应用程序中使用多个 NSWindows。但是在iPhone中,我们可以在一个iPhone应用程序中使用多个UIWindows吗?非常具体地说,我的应用程序中有 3 个 xib 文件: 1. 主窗口.xib 2.ViewController(与appDelegate结合) 3. MyCustomViewController ...其中我想使用 UIwindow 和该窗口的多个视图。

现在我的问题是,我已经在 MainWindow.xib 中使用 UIWindow,我可以在 MyCustomeViewController.xib 中使用另一个 UIWindow 吗???

此致

hi
I am an iphone newbie, so a little confused in UIWindow concept. On Mac, we can use multiple NSWindows in one application, i guess. But in iphone, can we use multiple UIWindows in one iphone application. To be very specific, i have 3 xib files in my application:
1. MainWindow.xib
2. ViewController (coupled with appDelegate)
3. MyCustomViewController... wherein i want to use UIwindow and multiple views with that window.

Now my question is that i am already using UIWindow in MainWindow.xib, can i use use another UIWindow in MyCustomeViewController.xib???

Best regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

方圜几里 2024-10-26 08:51:56

根据文档,您不需要也不应该在 iPhone 上使用多个窗口。

您需要的是更改屏幕上当前存在的视图控制器。

从 ViewController 中,您可以采取多种方式呈现 MyCustomViewController:
1. 如果您将 ViewController 放入导航控制器中,请使用 UINavigationController 的方法 - (void)pushViewController:(UIViewController *)viewControllerAnimated:(BOOL)animated。

  1. 使用 UIViewController 类的 - (void)presentModalViewController:(UIViewController *)modalViewControllerAnimated:(BOOL)animated 方法。

ViewController 方法内部类似于下面的内容:

MyCustomViewController *vc = [MyCustomViewController new];
[self presentModalViewController: vc animated: YES];
[vc release];

请参阅“iOS 视图控制器编程指南”进行详尽的讨论:

You don't need and shouldn't use several windows on iPhone according to the documentation.

What you need is to change view controllers currently present on the screen.

From you ViewController you can take to ways to present MyCustomViewController:
1. Employ UINavigationController's method - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated if case you put your ViewController inside a navigation controller.

  1. Use - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated method of UIViewController class.

something like below inside you ViewController methods:

MyCustomViewController *vc = [MyCustomViewController new];
[self presentModalViewController: vc animated: YES];
[vc release];

see "View Controller Programming Guide for iOS" for exhaustive discussion: http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html

橘虞初梦 2024-10-26 08:51:56

您不需要使用另一个窗口,只需在可用的 UIWindow 和 UIWindow 上不断交换视图即可。你会没事的。

You do not need to use another window just keep swapping views on the available UIWindow & you'll be fine.

夕嗳→ 2024-10-26 08:51:56

这不是 iOS 应用程序的标准方法。

如果您仍然想这样做,请参阅此答案

向 iOS 应用添加另一个 UIWindow 的优点、问题和示例?

This is not the standard approach for iOS apps.

If you still want to do it see this answer

Advantages, problems, examples of adding another UIWindow to an iOS app?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文