Skip to content

Instantly share code, notes, and snippets.

@haxpor
Created September 29, 2015 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haxpor/50c3ae54e69ebc6f87c8 to your computer and use it in GitHub Desktop.
Save haxpor/50c3ae54e69ebc6f87c8 to your computer and use it in GitHub Desktop.
Get the top UIWindow as seen in KLCPopup (https://github.com/jmascia/KLCPopup)
// Prepare by adding to the top window.
if(!self.superview){
NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication] windows] reverseObjectEnumerator];
for (UIWindow *window in frontToBackWindows) {
if (window.windowLevel == UIWindowLevelNormal) {
[window addSubview:self];
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment