uiwindow

Set rootViewController iOS 13

好久不见. 提交于 2019-12-01 06:44:54
问题 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 been using to set this has now stopped working class func setLoginAsInitialViewContoller(window:UIWindow) { print("SET LOGIN") let storyboard = UIStoryboard(name: "Login", bundle: nil) let controller = storyboard.instantiateViewController(withIdentifier: "LoginViewController") controller

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

时光毁灭记忆、已成空白 提交于 2019-12-01 02:40:51
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 the .XIB file in XCode and change the class for the main window to MyWindow. However, I'm unable to find any section where I can change this in storyboard. Does anyone know where I can do this? I need the main window to load MyWindow, not UIWindow. When using storyboards the application delegate and main window are no longer represented in Interface Builder. Instead, when your app starts, your

iOS self.window - when is it created?

梦想的初衷 提交于 2019-12-01 01:47:07
问题 when you start your app using single view template, and you add the NSLog(@"self.window = %@", self.window); in your first line of the AppDelegate.m's application: didFinishLaunchingWithOptions: method, you can see that self.window exists in your app. However, when you start your app using empty template, and tried to log the self.window to the console, the result returns null . Even if you add storyboard and a view controller, and set its view controller as the initial view controller, and

How to change the default View Controller that is loaded when app launches?

早过忘川 提交于 2019-11-30 20:48:24
I have an application, say 'MyApp', which by default loads the view controller 'MyAppViewController' whenever the application launches. Later, I added a new view controller 'NewViewControler' to the project. I now want the 'NewViewController' to be my default view controller which loads when the app launches. Please let me know what changes I need to make in my project to achieve this. Open MainWindow.xib and replace MyAppViewController with NewViewController. In your app delegate class, replace the property for MyAppViewController with one for NewViewController. Connect NewViewController to

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

眉间皱痕 提交于 2019-11-30 17:56:24
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 window property if it wants to use a main storyboard file. 2012-11-07 22:46:34.722 myTableViewControl[12021:c07] -[AppDelegate setWindow:]: unrecognized selector sent to instance 0x7674e70 2012-11-07 22:46:34.723 myTableViewControl[12021:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate setWindow:]: unrecognized selector sent to instance 0x7674e70' ***

Using UIScreen to drive a VGA display - doesn't seem to show the UIWindow?

自作多情 提交于 2019-11-30 12:21:18
问题 HI there, I'm trying to use UIScreen to drive a separate screen with the VGA dongle on my iPad. Here's what I've got in my root view controller's viewDidLoad: //Code to detect if an external display is connected to the iPad. NSLog(@"Number of screens: %d", [[UIScreen screens]count]); //Now, if there's an external screen, we need to find its modes, itereate through them and find the highest one. Once we have that mode, break out, and set the UIWindow. if([[UIScreen screens]count] > 1) //if

What does setting the UIWindow's rootViewController do?

痴心易碎 提交于 2019-11-30 12:02:49
问题 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 the UIWindow's reference. My question is about the particular phase : "installs the view controller’s view as the content view of the window" What does exactly content view refer to ? http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWindow_Class/UIWindowClassReference

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

拜拜、爱过 提交于 2019-11-30 10:48:57
问题 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 { return YES; } - (void) dumpView: (UIView *) view { CGRect frame = view.frame ; CGRect bounds = view.bounds ; CGPoint center = view.center ; NSLog(@"view [%@]:%d frame=%@ bounds=%@ center=%@" , NSStringFromClass(view.class) , [view hash] , NSStringFromCGRect(frame) , NSStringFromCGRect(bounds) ,

How to change the default View Controller that is loaded when app launches?

假装没事ソ 提交于 2019-11-30 05:47:50
问题 I have an application, say 'MyApp', which by default loads the view controller 'MyAppViewController' whenever the application launches. Later, I added a new view controller 'NewViewControler' to the project. I now want the 'NewViewController' to be my default view controller which loads when the app launches. Please let me know what changes I need to make in my project to achieve this. 回答1: Open MainWindow.xib and replace MyAppViewController with NewViewController. In your app delegate class,

Using UIScreen to drive a VGA display - doesn't seem to show the UIWindow?

落爺英雄遲暮 提交于 2019-11-30 02:29:15
HI there, I'm trying to use UIScreen to drive a separate screen with the VGA dongle on my iPad. Here's what I've got in my root view controller's viewDidLoad: //Code to detect if an external display is connected to the iPad. NSLog(@"Number of screens: %d", [[UIScreen screens]count]); //Now, if there's an external screen, we need to find its modes, itereate through them and find the highest one. Once we have that mode, break out, and set the UIWindow. if([[UIScreen screens]count] > 1) //if there are more than 1 screens connected to the device { CGSize max; UIScreenMode *maxScreenMode; for(int i