Questions tagged [uiwindow]

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

uiwindow
Filter by
Sorted by
Tagged with
637 votes
18 answers
306k views

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's user avatar
  • 9,346
360 votes
30 answers
187k views

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's user avatar
  • 4,586
241 votes
8 answers
147k views

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 ...
adam's user avatar
  • 22.5k
97 votes
10 answers
108k views

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 ...
typeoneerror's user avatar
  • 56.4k
93 votes
3 answers
16k views

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,...
Krumelur's user avatar
  • 32.5k
52 votes
1 answer
51k views

How to use UIWindowScene.windows on iOS 15? [duplicate]

Currently, with iOS 14.6, I can call a function in my app that displays a share sheet using the following code: func share(link: URL) { let activityView = UIActivityViewController(activityItems: [...
calebm's user avatar
  • 665
48 votes
12 answers
40k views

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 ...
mHopkins's user avatar
  • 590
45 votes
6 answers
55k views

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 ...
user avatar
45 votes
10 answers
84k views

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 ...
bohan's user avatar
  • 1,669
44 votes
6 answers
44k views

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 ...
Ken's user avatar
  • 783
43 votes
4 answers
6k views

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 ...
Arbitur's user avatar
  • 38.9k
42 votes
13 answers
30k views

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 ...
Kenny Wyland's user avatar
  • 21.2k
40 votes
4 answers
26k views

What is the difference between UIApplication.sharedApplication.delegate.window and UIApplication.sharedApplication.keyWindow?

Can anyone help me understand the difference between the following two lines: [UIApplication.sharedApplication.delegate.window addSubview:myView]; [UIApplication.sharedApplication.keyWindow ...
tv.ashvin's user avatar
  • 705
39 votes
8 answers
44k views

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 ...
Jonathan.'s user avatar
  • 54.9k
37 votes
7 answers
45k views

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's user avatar
  • 760
35 votes
8 answers
47k views

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 ...
aryaxt's user avatar
  • 77k
35 votes
4 answers
43k views

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)+...
Nishit's user avatar
  • 591
32 votes
3 answers
8k views

Passing touches between stacked UIWindows?

I have two windows -- a front one, and a back one. The front one is used to overlay some stuff on top of the back one. I want to be able to capture touches on some parts of the front window, but not ...
Anna Dickinson's user avatar
31 votes
4 answers
10k views

subclassing UIWindow while using storyboards

I have same issue as explained in this question: Where can I change the window my app uses from UIWindow to my own subclass "MyWindow" with storyboard? My question is how do i implement a '...
izaslavs's user avatar
  • 403
31 votes
5 answers
19k views

iPhone - UIWindow rotating depending on current orientation?

I am adding an additional UIWindow to my app. My main window rotates correctly, but this additional window I have added does not rotate. What is the best way to rotate a UIWindow according to the ...
aryaxt's user avatar
  • 77k
27 votes
3 answers
41k views

View on top of everything: UIWindow subview VS UIViewController subview

In order to make a UIView on top of all views like the behavior of UIAlertView, the best way I see is by putting it in the app window, which is by adding the view to: [[[UIApplication ...
Zian Chen's user avatar
  • 510
26 votes
1 answer
4k views

Whats a key window in Objective-C Cocoa?

What is a key window? And what is it used for? I read its used for "key input";but could someone expand on this? An example would be appreciated.
fdh's user avatar
  • 5,316
25 votes
4 answers
15k views

How to disable long touch in UIWebView?

I want to disable long-touch from the application. I have no control on the HTML that I am loading on my WebView.
Alex Terente's user avatar
25 votes
5 answers
14k views

Changing the rootViewController of a UIWindow

When my app first loads, I set the rootViewController property of my UIWindow to controllerA. Sometime during my app, I choose to change the rootViewController to controllerB. The issue is that ...
aloo's user avatar
  • 5,381
25 votes
1 answer
6k views

UIWindow endDisablingInterfaceAutorotationAnimated: error

I'm receiving the following error when a user is in MFMailComposerViewController and presses the Home button: [UIWindow endDisablingInterfaceAutorotationAnimated:] called on > without matching -...
Maddy's user avatar
  • 251
23 votes
3 answers
9k views

Is it possible that an iOS application can have more than one window?

I have been asked this question many times in the interview searched every where didn't get any proper answer.So finally posting this question here.
Bharat Bhushan's user avatar
22 votes
5 answers
11k views

Making a button persistent across all view controllers

I want to have a persistent button in the bottom right corner of my app. During all view transitions, the button should remain static. I'm having trouble deciding what view to add the button to. I ...
D-Nice's user avatar
  • 4,802
21 votes
4 answers
23k views

makeKeyAndVisible & makeKeyWindow - uiwindow in iphone

In every application, there is always written as [window makeKeyAndVisible]; What is mean by makeKey?
sagarkothari's user avatar
  • 24.7k
21 votes
4 answers
4k views

UIStatusBarStyle changes after displaying a UIWindow over UIStatusBar

I am displaying a UIWindow over the UIStatusBar, by default the UIStatusBarStyle is set to UIStatusBarStyleLightContent, but when I display the UIWindow the UIStatusBarStyle switches to the black ...
David Gölzhäuser's user avatar
18 votes
6 answers
16k views

UIWindow with wrong size when using landscape orientation

I have an empty application and there is no storyboard or xib involved. I want to have a hidden status bar and support only landscape orientation. Again, I wan't to make those changes only within code ...
Joa Ebert's user avatar
  • 6,645
18 votes
3 answers
537 views

Resize a UIView to allow space for ad unit

I am trying to add an ad unit above a subclass of UIView RCTRootView. This would move the RCTRootView down about 50px. This is my current attempt. RCTRootView *rootView = [[RCTRootView alloc] ...
Patrick's user avatar
  • 1,420
16 votes
1 answer
7k views

What does setting the UIWindow's rootViewController do?

Assigning a view controller to this property (either programmatically or using Interface Builder) installs the view controller’s view as the content view of the window. The above quote is from ...
Stanley's user avatar
  • 4,476
16 votes
4 answers
13k views

Custom UIWindows do not rotate correctly in iOS 8

Get your application into landscape mode and execute the following code: UIWindow *toastWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; toastWindow.hidden = NO; toastWindow....
Reid Main's user avatar
  • 3,404
15 votes
1 answer
10k views

After rotation UIView coordinates are swapped but UIWindow's are not?

Using Xcode 4.2.1 iPad iOS 5.0.1, create a new "Single View" iPad project. In the controller, add: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { ...
verec's user avatar
  • 5,254
15 votes
7 answers
19k views

Capturing full screenshot with status bar in iOS programmatically

I am using this code to capture a screenshot and to save it to the photo album. -(void)TakeScreenshotAndSaveToPhotoAlbum { UIWindow *window = [UIApplication sharedApplication].keyWindow; if ([[...
Umair Khan Jadoon's user avatar
15 votes
3 answers
6k views

Why is AppDelegate.swift window an optional?

I was reading Apple docs, when I found this sentence: The AppDelegate class contains a single property: window. var window: UIWindow? This property stores a reference to the app’s window. This window ...
user avatar
14 votes
3 answers
2k views

UIWindow not filling screen for new devices?

I'm working with an old Xcode project which is roughly 7/8 years old and I've migrated it to Objective-C 2.0 and to support ARC. The project didn't support Auto-Layout (this was just before it was ...
Luke97's user avatar
  • 529
14 votes
1 answer
3k views

Where can I change the window my app uses from UIWindow to my own subclass "MyWindow" with storyboard?

I've got a universal project here with storyboard. I've created a subclass of UIWindow called MyWindow, and I need to load it instead of the default UIWindow. Prior to storyboard, I would simply go to ...
thebro's user avatar
  • 305
14 votes
1 answer
25k views

The app delegate must implement the window property if it wants to use a main storyboard file

I'm programmatically implement a list view controller. When I try to run the project, I got error: 2012-11-07 22:46:34.719 myTableViewControl[12021:c07] The app delegate must implement the ...
max's user avatar
  • 645
14 votes
2 answers
9k views

App called -statusBar or -statusBarWindow on UIApplication

I'm trying to build my app with Xcode 11 beta 6 and iOS 13 beta 8 but it throws this error once it starts to run: Terminating app due to uncaught exception 'NSInternalInconsistencyException', ...
Lukas Würzburger's user avatar
13 votes
1 answer
2k views

How did Vesper show users wallpaper without UIApplicationIsOpaque key?

An app named Vesper was updated for iOS 7 and shows the user's wallpaper on iOS 7. I have found that using UIApplicationIsOpaque key and UIBackgroundStyleLightBlur can show the users background but ...
Maximilian Litteral's user avatar
12 votes
1 answer
14k views

makeKeyWindow vs makeKeyAndVisible

What is the difference between makeKeyWindow and makeKeyAndVisible which are two methods of UIWindow ? When will a UIWindow be a keyWindow but will not be visible?
allenlinli's user avatar
  • 2,096
12 votes
6 answers
13k views

Dismiss all UIAlertControllers currently presented

Is there a way to dismiss all UIAlertControllers that are currently presented? This is specifically because from anywhere and any state of my app, I need to get to a certain ViewController when a ...
David's user avatar
  • 7,256
11 votes
5 answers
14k views

Set rootViewController iOS 13

After upgrading Xcode a critical part of my application has stopped working. When my app launches I run a function to check boolean flags and set the correct rootViewController. But the code I have ...
user avatar
11 votes
3 answers
3k views

Manually Created UIWindow is Wrong Size

I am learning how to create an iOS app without Interface Builder (i.e. storyboards, xibs, etc.). Below is the basic app delegate class I am working with. The problem is that when displayed the ...
joshwbrick's user avatar
  • 5,922
10 votes
3 answers
8k views

What is the purpose of UIWindow?

I've always seen references to an app's 'window', and I see that AppDelegates usually have a UIWindow property called 'window'. So I'm just wondering how to perceive this UIWindow object. I see that ...
hgwhittle's user avatar
  • 9,346
10 votes
1 answer
2k views

How to detect window resizing in Mac Catalyst?

How can I a get a notification when user resize the window while: NotificationCenter.default.addObserver(self, selector: #selector(function), name: NSWindowDidResizeNotification, object: nil) is ...
Mansour's user avatar
  • 515
10 votes
4 answers
12k views

Xcode 11 beta: AppDelegate file doesn't have window global variable

I am facing an issue in Xcode 11 beta. The problem is that I am not getting default window variable declared in AppDelegate file. Is anybody facing this same issue?
Rashesh Bosamiya's user avatar
10 votes
1 answer
256 views

How can Window from Object Library in Interface builder be used

I've been doing iOS developement for a while but never used or seen someone using the Window object. I tried googling about it but I did not found any relevant articles. I know about 'UIWindow' object ...
Jelly's user avatar
  • 4,522
9 votes
8 answers
28k views

How to add view in UIWindow?

I wanted to add a view in UIWindow with following code: AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate; UIWindow *window = delegate.window; UIView *aView = [[...
Prajeet Shrestha's user avatar

1
2 3 4 5
14