uiwindow

Blacked-out interface rotation when using second UIWindow with rootViewController

☆樱花仙子☆ 提交于 2019-12-05 00:30:15
问题 (iOS 7.0.3, Xcode 5.0.1) I have a second UIWindow in my app used to display a custom magnifier above the status bar. However, once I set the rootViewController of this window (for interface rotation & some other stuff), the main window goes black during the interface rotation animation. To reproduce: create single view iOS application and add the following to the main UIViewController. // To @interface: @property (nonatomic, strong) UIWindow *secondWindow; // In viewDidLoad: self.secondWindow

Get Application's main window

女生的网名这么多〃 提交于 2019-12-04 23:40:31
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 window? Espresso The UIApplicationDelegate usually has a reference to the "main window": [[[UIApplication sharedApplication] delegate] window]; Furthermore, UIApplication has an array of windows [[UIApplication sharedApplication] windows] . See the UIApplication Class Reference . I'm not 100% sure this works in every case but this should work: UIWindow *mainWindow = [UIApplication sharedApplication]

Setting UIScreen's mode / resolution

十年热恋 提交于 2019-12-04 17:24:35
I have to set the external UIScreen's mode to run with the resolution 1024x768. First I search if the screen supports this resolution: if ([[UIScreen screens] count] > 1){ CGSize size1024; size1024.height = 0; size1024.width = 0; UIScreenMode *screenMode1024 = nil; UIScreen *secondScreen = [[UIScreen screens] objectAtIndex:1]; for(int i = 0; i < [[secondScreen availableModes] count]; i++) { UIScreenMode *current = [[[[UIScreen screens] objectAtIndex:1] availableModes] objectAtIndex: i]; if (current.size.width == 1024.0 && current.size.height == 768.0) { size1024 = current.size; screenMode1024

Passing touches between stacked UIWindows?

删除回忆录丶 提交于 2019-12-04 15:26:59
问题 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 others; I want the front window to receive touches in some areas, but pass them through to the back window in others. Any ideas as to how I'd do this? 回答1: Ok, here's what I did: I created two views in the front window. The first view covered the area where I wanted to catch the touches; the

trouble with displaying another UIWindow

会有一股神秘感。 提交于 2019-12-04 14:45:36
I'm writing an iPad app, and I'm trying to display a second UIWindow on top of the main window in my app. The main thing I'm trying to do is create a log in window ( how to present a login, with UISplitViewController? ), and it seems that creating a second window here might be a good option. I've made a very simple app to try this out. When the user hits a button, then I'm trying to show the second window. Here's the code: - (IBAction)showOtherWindow:(id)sender { UIWindow* otherWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; otherWindow.hidden = NO; otherWindow

“Normal” UIButton causing obj_stack_overflow or EXC_BAD_ACCESS exception

孤街浪徒 提交于 2019-12-04 10:16:11
It sure looks innocuous enough. In my App Delegate, I check NSUserDefaults for a flag to show tips at startup. If it’s set then, at the end of applicationDidFinishLaunching: , I do this: TipsViewController *vc = [[TipsViewController alloc] initWithNibName:@“TipsView" bundle:nil]; [window addSubview:vc.view]; [vc release]; The idea is to show this view temporarily. (Note that it’s not a modal VC. No Navigation Controller at this point, plus there’s no navigation bar in this view anyway.) Once this view is dismissed, we’ll add our pre-empted UITabBarController ’s view to the window and

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

有些话、适合烂在心里 提交于 2019-12-03 23:53:00
问题 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. 回答1: When using storyboards the application

how to get my UIWindow using UIApplication?

 ̄綄美尐妖づ 提交于 2019-12-03 18:44:10
问题 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

How did Vesper show users wallpaper without UIApplicationIsOpaque key?

◇◆丶佛笑我妖孽 提交于 2019-12-03 16:50:00
问题 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 will not pass validation. Vesper passed validation and passed Apple. I did upload this question to the dev forums, but apple has taken it down. 回答1: Brent Simmons has written a blog post explaining it. It seems like they didn't use UIApplicationIsOpaque key. The Sidebar In 1.0 our sidebar menu

Blacked-out interface rotation when using second UIWindow with rootViewController

烂漫一生 提交于 2019-12-03 14:27:43
(iOS 7.0.3, Xcode 5.0.1) I have a second UIWindow in my app used to display a custom magnifier above the status bar. However, once I set the rootViewController of this window (for interface rotation & some other stuff), the main window goes black during the interface rotation animation. To reproduce: create single view iOS application and add the following to the main UIViewController. // To @interface: @property (nonatomic, strong) UIWindow *secondWindow; // In viewDidLoad: self.secondWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.secondWindow.rootViewController