[UIAlertView 显示] 是工作的?
问题说明
我想做一些类似于 UIAlertView 的事情,即 - 不参考任何 UIView 或 UIViewController,使用 presentModalViewController 在所有窗口之上呈现一个 UIViewController.
I want to do something similar to UIAlertView, ie - without reference to any UIView or UIViewController, present a UIViewController on top of all windows using presentModalViewController.
查看文档我找不到可行的方法!
Looking at the documentation I can't find a way in which this is possible!
在 OS4 中,有这样的东西:
In OS4, there is something like this:
UIWindow *window = [UIApplication sharedApplication].keyWindow
UIViewController *rootViewController = window.rootViewController
...但这在 OS3 中是不可能的.
...but this is not possible in OS3.
有谁知道如何在OS3中实现同样的效果?
Does anyone know how to achieve the same effect in OS3?
谢谢!
好的 - 所以我通过无数对 ViewController 本身的委托回调解决了这个问题!虽然这是实现这一目标的正确方法,但似乎有点奇怪,因为在执行的任何阶段都不可能获得顶部视图控制器的句柄以获取警报(等).
OK - so I solved this with a myriad of delegate callbacks to the ViewController itself! Although it's the proper way to achieve this, it did seem kind-of odd that's it's not possible at any stage in execution get a handle to the top View Controller for alerts (etc).
如果有人知道如何实现这一点,我仍然很感兴趣!
If anyone knows how to achieve this, I'd be still really interested!
正确答案
UIAlertView
在应用程序的主窗口上方创建自己的 UIWindow
,makeKeyAndVisible
-s 它,并在该窗口中自己的视图中设置动画.
UIAlertView
creates its own UIWindow
above your application's main window, makeKeyAndVisible
-s it, and animates in its own views in that window.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfhggh
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20