Questions tagged [uiwindow]

The UIWindow class defines objects (known as windows ) that manage and coordinate the windows an application displays on the screen.

In iOS, windows and views are used to present application’s content on the screen. Windows do not have any visible content themselves but provide a basic container for application’s views. The two principal functions of a window are to provide an area for displaying its views and to distribute events to the views. The window is the root view in the view hierarchy. A window belongs to a level; the windows in one level appear above another level. For example, alerts appear above normal windows. Typically, there is only one window in an iOS application.

627 questions
592
votes
17 answers

How to tell if UIViewController's view is visible

I have a tab bar application, with many views. Is there a way to know if a particular UIViewController is currently visible from within the UIViewController? (looking for a property)
Rob Bonner
  • 8,650
  • 8
  • 32
  • 52
220
votes
6 answers

iPhone - Get Position of UIView within entire UIWindow

The position of a UIView can obviously be determined by view.center or view.frame etc. but this only returns the position of the UIView in relation to it's immediate superview. I need to determine the position of the UIView in the entire 320x480…
adam
  • 21,709
  • 20
  • 83
  • 117
186
votes
17 answers

How to resolve: 'keyWindow' was deprecated in iOS 13.0

I'm using Core Data with Cloud Kit, and have therefore to check the iCloud user status during application startup. In case of problems I want to issue a dialog to the user, and I do it using…
Hardy
  • 2,424
  • 2
  • 12
  • 20
98
votes
10 answers

Getting reference to the top-most view/window in iOS application

I'm creating a reusable framework for displaying notifications in an iOS application. I'd like the notification views to be added over the top of everything else in the application, sort of like a UIAlertView. When I init the manager that listens…
typeoneerror
  • 51,338
  • 32
  • 124
  • 213
92
votes
3 answers

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. My question is kind of vague, but I'm interested in: What could I potentially…
Krumelur
  • 29,920
  • 21
  • 114
  • 240
45
votes
4 answers

how to get my UIWindow using UIApplication?

I have only one window and I tried UIWindow* mWindow = [[UIApplication sharedApplication] keyWindow]; but this returned nil. I also tried: UIWindow* mWindow = (UIWindow*)[[UIApplication sharedApplication].windows objectAtIndex:0]; But this raised…
user416445
44
votes
6 answers

Orientation in a UIView added to a UIWindow

I have a UIView which is supposed to cover the whole device (UIWindow) to support an image zoom in/out effect I'm doing using core animation where a user taps a button on a UITableViewCell and I zoom the associated image. The zooming is performing…
Ken
  • 743
  • 1
  • 8
  • 17
42
votes
9 answers

To create a new UIWindow over the main window

In my app I want to create a new UIWindow over the main UIWindow, And I wrote as following, but it don't works. first, i create a UIWindow as the main window, and then make it key and visible, and then create a new UIWindow overlay, but nothing…
bohan
  • 1,529
  • 2
  • 16
  • 26
40
votes
4 answers

Why is main window of type double optional?

When accessing UIapplication's main window it is returned as a UIWindow?? let view = UIApplication.sharedApplication().delegate?.window // view:UIWindow?? Why is it returning as a double optional and what does it mean and if put into a if let…
Arbitur
  • 36,899
  • 22
  • 86
  • 123
39
votes
12 answers

UIWindow not showing over content in iOS 13

I am upgrading my app to use the new UIScene patterns as defined in iOS 13, however a critical part of the app has stopped working. I have been using a UIWindow to cover the current content on the screen and present new information to the user, but…
mHopkins
  • 500
  • 1
  • 4
  • 10
38
votes
12 answers

unexpected nil window in _UIApplicationHandleEventFromQueueEvent

One of my old apps is not working with iOS8. When I start the app up, and try to tap on the screen anywhere, I get this message in my console: unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow:
Kenny Wyland
  • 19,242
  • 24
  • 109
  • 205
35
votes
7 answers

iOS - Get location of a view in a window?

I have a UIView that displays a popup after it's been clicked. The popup needs to be added to the main UIWindow to make sure that it goes on top of everything else. I want the position of this popup to be relative to my UIView, so I need to know the…
aryaxt
  • 69,636
  • 87
  • 281
  • 421
34
votes
7 answers

How to remove a UIWindow?

I thought it was easy as [myWindow resignKeyWindow] and [self.window makeKeyAndVisible] but I guess not… Would you guys know what to do? Thanks :)
G33kz0r
  • 720
  • 1
  • 8
  • 17
33
votes
4 answers

Convert a UIView origin point to its Window coordinate system

I want to get the origin of scrollView in the window coordinate system. For Example, presently, scollView origin is (0,51). But in window coordinate system it should be 51 + 44(navigation bar height)+20(status bar height) = 115. Means in window…
Nishit
  • 573
  • 1
  • 6
  • 17
33
votes
8 answers

Get Application's main window

UIApplication has a method keyWindow, however if an alert view is showing then this returns the window of the alert view and not the main window of the application. How can I get the app's main window?
Jonathan.
  • 51,850
  • 46
  • 174
  • 275
1
2 3
41 42