English 中文(简体)
优点、问题、将另外一名女方贞子添加到SOS的事例?
原标题:Advantages, problems, examples of adding another UIWindow to an iOS app?

Recently I ve been wondering about the fact that that an iOS app only has one UIWindow. It does not seem to be an issue to create another UIWindow and place it on screen.

我的问题是模糊的,但我很想:

  • What could I potentially achieve with a second UIWindow that cannot be done in other ways?
  • What can go wrong when using multiple UIWindow instances?
  • I have seen that people use a 2nd UIWindow to display popover like views on iPhone. Is this a good way of doing it? Why? Why not?
  • Are there other examples where it is making perfectly sense to have another UIWindow?

这并不是说我没有东西。 我从未感到有必要创建另一个<条码>。 例如,但可能允许做令人吃惊的事情,我不知道!

I m hoping that it might help me solve this problem: I need to add a "cover view" over whatever is currently displayed. It should also work if there are already one or more modal controllers presented. If I add a UIView to the root controller s view, the modal controllers sit on top, so do the popover controllers. If I present the cover view modally and there is already a modal controller, only part of the screen is covered.

最佳回答

缩略语

处理您的最后一段: 制作一个<条码>IDWindow,其范围与你的主要窗口相同。 Set its windowlevel property to UIWindowStatus Bar Set its hidden/code> property to NO.

问题回答

首先,我做了一片手脚的回答,我要为试图获得有关这个专题的信息的其他人写一些说明:

  • It is not a problem at all to add another UIWindow. Just create one and makeKeyAndVisible. Done.
  • Remove it by making another window visible, then release the one you don t need anymore.
  • The window that is "key" receives all the keyboard input.
  • UIWindow covers everything, even modals, popovers, etc. Brilliant!
  • UIWindow is always portrait implicitly. It does no rotate. You ll have to add a controller as the new window s root controller and let that handle rotation. (Just like the main window)
  • The window s level determines how "high" it gets displayed. Set it to UIWindowLevelStatusBar to have it cover everything. Set its hidden property to NO.
  • A 2nd UIWindow can be used to bring views on the screen that float on top of everything. Without creating a dummy controller just to embed that in a UIPopoverController.
  • It can be especially useful on iPhone where there is no popover controller but where you might want to mimic something like it.
  • And yes, it solved of course my problem: if the app resigns activation, add a cover window over whatever is currently shown to prevent iOS from taking a screenshot of your app s current content.

Here is Apple s Documentation for better understanding UIWindow: https://developer.apple.com/library/archive/documentation/WindowsViews/Conceptual/WindowAndScreenGuide/WindowScreenRolesinApp/WindowScreenRolesinApp.html

采用多例“IDWindow”的好不过是具体的原因之一,是你需要录相机。 你可能不想在最后录制的录像中包含某些内容(记录纽芬兰语、记录身份等),因此,你可以把这些内容放在独一无二的IDWindow上。

事实上,如果你使用ReplayKit,你将 have to<>em>为这些被排除在外的金融情报中心分子单独使用IDWindow。 更具体地说: https://medium.com/ar-tips-and-tricks/how-to-record-a-cr-capture-with-replaykit-whil-st-hiding-the-the-e-clement-cae 831





相关问题
How do you create UIBarButtonItems with a radio interface?

I have a UIToolbar that needs three buttons in a radio style, meaning that of the three, only one button can be pushed at a time. The documentation makes reference to the possibility of setting up ...

iPhone settings bundle

I want to allow the user to enter a valid date using the iPhone’s settings application. I have experimented with many of the PreferenceSpecifiers data node types including date. I have two issues: ...

Circular #import/@class problem in ObjectiveC

I m going to use an example to properly illustrate my confusion. I can t quite wrap my head around this. In Cocoa touch, we have UIViewController and its subclass, UINavigationController. Now, UIVC ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Cocoa-Touch: issue looping MPMoviePlayerController

I have an app which has to load some data at startup, so I want to display a splash-screen animation. I m using the MPMoviePlayerController to play a m4v file. The movie has it s background set to [...

Iphone sequential animation with setAnimationDelay

I m trying to chain animation events. The application I m coding for work has a multiple choice quiz. First you pick your multiple choice answer. The quiz view fades away. Then a label ("correct" or "...