uiwindow

UIWindow.makeKeyAndVisible() throws “props must have a valid clientID” error in XCTest

强颜欢笑 提交于 2019-12-12 14:28:49
问题 I am testing a UIViewController in Xcode with an XCTest. In order to test some navigation and alert functionality I need to put my view controller in a UIWindow. I do so with the following code: let myViewController = UIViewController() let window = UIWindow(frame: UIScreen.main.bounds) window.rootViewController = myViewController window.makeKeyAndVisible() However when makeKeyAndVisible() is called my test fails with the following error: 2018-01-04 10:56:31.068462-0500 xctest[7858:315680] **

Battling with Xcode not displaying my UIWindow

只愿长相守 提交于 2019-12-11 12:22:28
问题 See edit at the end of the question I'm trying to get a simple iPhone app up and running and failing miserably :( I have a very simple set up. I have an app delegate, a view controller, and an xib file containing a UIWindow with a UIImageView and three UIButton s on it. The problem is that when I start my app, the UIWindow never gets displayed. I'm sure I'm just missing some sort of connection in Interface Builder (I'm running XCode 4, by the way). I'm just completely lost as to what might be

How to differentiate top windows in iOS8?

限于喜欢 提交于 2019-12-11 12:08:35
问题 Following the strategy from this SO answer, in iOS 7 I could find the top window in my app like so: UIWindow *topWindow = [[[UIApplication sharedApplication].windows sortedArrayUsingComparator:^NSComparisonResult(UIWindow *win1, UIWindow *win2) { return win1.windowLevel - win2.windowLevel; }] lastObject]; However, since iOS8 there may be one or more UITextEffectsWindow s which may be the lastObject in the above strategy. No good. Initially I could run a predicate filter on the array of

UIWindow and UIView addSubview Question

孤街醉人 提交于 2019-12-11 10:12:50
问题 Does the addSubview method actually load the view into the application or not? The reason I am asking is because I have two two views in my application. The application delegate adds the two views as subviews and then brings one of the views up front. Now, I have a print statement in each of the viewDidLoad methods for each view. When I run the application, the application delegate loads the views as subViews and as each view is loaded, I actually see the console print out the statements that

Status bar rotates separated from UIWindow

孤街浪徒 提交于 2019-12-11 04:48:41
问题 I have to create application with two UIWindow (please, don't ask why). First UIWindow 's rootViewController supports all orientations. Second one - only portrait and upside down. So application delegate code looks like: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // part one self.windowOne = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; self.windowOne.rootViewController = [[ViewControllerOne

Custom UIView covering UITabBar on iPhone but not iPad

半城伤御伤魂 提交于 2019-12-11 04:43:18
问题 I'm creating a custom uiView that covers the window. It acts kinda like a decoy uiview in a navigation controller. So I had to do it this way to cover the navigation bar.... long story... Here is how it gets setup. self.searchPopDown.frame = CGRectMake(0, 20, self.navigationController.view.frame.size.width, self.navigationController.view.frame.size.height-20); self.searchPopDown.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; The 20 is to compensate for

Trigger an event / method when UIWindow RootViewController changes SWIFT

删除回忆录丶 提交于 2019-12-11 01:56:43
问题 I'm working on an iOS framework. I have a requirement to log events when user enters or exits a particular View Controller. For that I was thinking if somehow I could be able to register a notification to trigger a custom method when the root view controller changes. Or perhaps use KVO. But I don't understand how to do this from an implementation point of view since I cannot find any such notification. Any help in this regard would be highly appreciated. Thanks. Please note that this is a

Swift iOS -How to Switch / Toggle between two UIWindows and make either the keyWindow

五迷三道 提交于 2019-12-11 00:46:59
问题 I created an additional UIWindow that will get presented on top of the main window. The user presses a button and it transitions over the main window. The user can minimize the additional window and it will sit above the tabBar like it the picture below. They can enlarge it to cover the main window or dismiss it and it gets destroyed. It works fine. I also created a custom action sheet that launches from the bottom of the screen. If the additional window completely covers the main window and

Programatically Hiding Status Bar When Adding New UIWindow?

試著忘記壹切 提交于 2019-12-10 17:44:18
问题 I'm currently adding a new UIWindow to my app when displaying my own custom alert. Before adding this UIWindow my app had the status bar hidden, but now it is visible. How can I hide the status bar programatically in this new window. I've tried everything but it doesn't work. This is how I add my UIWindow: notificationWindow = [[UIWindow alloc] initWithFrame: CGRectMake(0, 0, 1.0, 1.0)]; notificationWindow.backgroundColor = [UIColor clearColor]; // your color if needed notificationWindow

uiview doesn't show in app delegate

淺唱寂寞╮ 提交于 2019-12-10 15:38:27
问题 When I execute the code below in the simulator I expect to see red fill the screen, but instead it's all black, why? - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIView * myView = [[UIView alloc] initWithFrame:[window bounds]]; [myView setBackgroundColor:[UIColor redColor]]; [window addSubview:myView]; [window makeKeyAndVisible]; return YES; } If I add initialization of window, that doesn't help: window = [[[UIWindow alloc]