uiwindow

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

跟風遠走 提交于 2019-11-26 12:26:51
问题 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

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

て烟熏妆下的殇ゞ 提交于 2019-11-26 11:51:30
问题 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 for NSNotification events and adds views in response, I need to get a reference to the top-most view in the application. This is what I have at the moment: _topView = [[[[UIApplication sharedApplication] keyWindow] subviews] lastObject]; Would this

subclassing UIWindow while using storyboards

∥☆過路亽.° 提交于 2019-11-26 11:24:42
问题 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 \'window\' getter method in my app delegate that returns \'MyWindow\' subclass? Or maybe there is other ways to assign my subclass to my app\'s main window? 回答1: UIWindow in a Storyboard project can be subclassed as explained in Apple's UIApplicationDelegate reference: window When a storyboard is being used,

Making a button persistent across all view controllers

会有一股神秘感。 提交于 2019-11-26 08:08:54
问题 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 know the button ought to be stored in the AppDelegate, but I don\'t know what other view it would be sense to add it to except the window. One downside of adding it to the window is that when there\'s an app running in the background (ie Phone), the added status bar padding will push down the

iPhone - Get Position of UIView within entire UIWindow

白昼怎懂夜的黑 提交于 2019-11-26 07:53:02
问题 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 co-ordinate system. For example, if the UIView is in a UITableViewCell it\'s position within the window could change dramatically irregardless of the superview. Any ideas if and how this is possible? Cheers :) 回答1: That's an easy one: [aView

How to tell if UIViewController's view is visible

霸气de小男生 提交于 2019-11-26 00:26:31
问题 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) 回答1: The view's window property is non-nil if a view is currently visible, so check the main view in the view controller: Invoking the view method causes the view to load (if it is not loaded) which is unnecessary and may be undesirable. It would be better to check first to see if it is already loaded. I've