uiwindow

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

妖精的绣舞 提交于 2019-11-30 01:29:51
问题 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

how to get my UIWindow using UIApplication?

一笑奈何 提交于 2019-11-30 01:14:01
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 an exception and the app closed, when I tried to print out [[UIApplication sharedApplication].windows count] It printed 0 Note: I am putting this in my only view controller's viewDidLoad method and this is completely a new iPad View Based Application so I changed nothing, just trying to get the window Please help me to get this object If your main

View on top of everything: UIWindow subview VS UIViewController subview

瘦欲@ 提交于 2019-11-29 21:32:25
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 sharedApplication] delegate] window] However, the downside I found is that it doesn't automatically take in rotation. In order for it to take in rotation, the best way to do is by adding the view on current AppDelegate window.navigationController / rootViewController , however, by doing this it will no longer be on top of everything. Let say when view is displaying and there is a modalViewController popup, the

Unknown error [UIWindow endDisablingInterfaceAutorotation]

喜夏-厌秋 提交于 2019-11-29 14:34:22
问题 I am receiving this error. I have no clue as to why it would be called, and Google didn't really help. Any suggestions? -[UIWindow endDisablingInterfaceAutorotation] called on <UIWindow: 0x4e0ec50; frame = (0 0; 320 480); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x4e0f9e0>> without matching -beginDisablingInterfaceAutorotation. Ignoring. 回答1: Looks like you have to call -beginDisablingInterfaceAutorotation first and you're not doing that. 回答2: I recently had the same problem. It

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

只愿长相守 提交于 2019-11-29 07:59:57
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 UIApplication.shared.keyWindow?.rootViewController?.present(...) up to now. In Xcode 11 beta 4, there is now a new deprecation message, telling me: 'keyWindow' was deprecated in iOS 13.0: Should not be used for applications that support multiple scenes as it returns a key window across all connected scenes How shall I present the dialog instead? This is my solution: let keyWindow = UIApplication.shared

iOS - UIEventTypeRemoteControl events not received

≡放荡痞女 提交于 2019-11-29 07:46:20
I have this in the AppDelegate (didFinishLaunching): [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; I tried handling the events in the relevant view controllers but that was spotty (some view controllers would get the events and others wouldn't, even when they were first responders). I tried subclassing UIApplication. That didn't work. Now I'm trying to subclass UIWindow and do this (see the comments): - (void)sendEvent:(UIEvent *)event { if (event.type == UIEventTypeRemoteControl) { NSLog(@"I wish this happened"); //this never happens } else { NSLog(@"some other event"

How to use multiple iOS custom view controllers without a navigation controller

点点圈 提交于 2019-11-29 03:19:00
问题 I am building an app that uses multiple types of screens--all which warrant their own custom view controllers. I am successfully switching between view controllers and their related views by reassigning the main window 's rootViewController with a method in my app delegate like the following: - (void)changeRootViewController:(NSString *)controllerName { if (controllerName == @"book") { rootViewController = (UIViewController *)[[BookViewController alloc] init]; [self.window

Why is AppDelegate.swift window an optional?

有些话、适合烂在心里 提交于 2019-11-29 01:43:08
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 represents the root of your app’s view hierarchy. It is where all of your app content is drawn. Note that the window property is an optional , which means it may have no value (be nil ) at some point. What I don't understand is: why this property at some point could be nil? What's the case for it to be(come) nil? When you close your application, your app can still receive silentNotifications or

Height and width on iPhone (/iPad)

喜夏-厌秋 提交于 2019-11-28 21:54:15
This is just a test application, There is only a AppDelegate class to create all I did was create a Window based app, set the supported orientations to only the landscape in the info.plist, and then add the following code: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [application setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft]; // Override point for customization after application launch. UIAlertView *test = [[UIAlertView alloc] initWithTitle:@"hu" message:@"hui" delegate:nil cancelButtonTitle:@"hi"

Putting a UIView or UIWindow above Statusbar

感情迁移 提交于 2019-11-28 20:54:59
My goal is to draw an invisible button above the status bar on the top of my iPhone app (dimension 320*20 pixels). No matter what I try, something is buggy: For example, I tried to create a new view. When I want to place the view on the top of my app, it always disappears behind the status bar instead of being in front of it! I found another great idea on Stackoverflow: Add UIView Above All Other Views, Including StatusBar Even if a second UIWindow isn't recommended, I tried to implement it. It worked as I wanted until the moment that I noticed a problem: the keyboard doesn't appear anymore