Question

When an iPhone app with GameKit launches, and the device is already logged in to GameCenter, a small message slides in on top of the screen, saying something along the lines of "Welcome back %username!".

What I found out is the following: that message appears in its own UIWindow that eventually slides the message away and releases itself. When the message is onscreen, you can log out the following:

all windows: ( "<UIWindow: 0x31fc70; frame = (0 0; 320 480); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x31fe60>>", "<UIWindow: 0x3874c0; frame = (0 0; 320 480); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x387590>>" )

I need to distinguish the two windows in the general case -- I need something along the lines of a -(UIWindow *)topNormalWindow function that will return the topmost window that isn't either A)an alert or B)the gamecenter message. I already have a -(UIWindow *)topNonAlertWindow that determines the top window that isn't an alert, but the gamekit message isn't, but nor is it (for my purposes) a normal window.

Also, what does autoresize = RM+BM; mean?

Was it helpful?

Solution

I solved this problem by simply checking if the window had a GKGameEventView as a subview.

OTHER TIPS

I've been using Game Center and adding a notification system for achievements. I get the top window like this:

[[UIApplication sharedApplication] keyWindow]

Doesn't seem to conflict with alerts or the game center authentication window. In fact, my notifications get added under that window, so I think that one is on another layer above anything you can access.

Regarding your last question:

What does autoresize = RM+BM; mean?

RM+BM is shorthand for the UIViewAutoresizing masks, UIViewAutoresizingFlexibleRightMargin and UIViewAutoresizingFlexibleBottomMargin, respectively. If you select a UI control in Interface Builder and go to the Size Inspector, the Autosizing graphic shows red "I-Beams" where the control is anchored to its bounding view. If Autoresizing = RM+BM, it means that you should see the top and left anchor beams (the I-Beams) in red, but the right and bottom ones are dimmed out. This essentially means that the right and bottom margins are flexible, and the layout manager is free to adjust them while rendering the view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top