Skip to content

Instantly share code, notes, and snippets.

View bawn's full-sized avatar
💭
I may be slow to respond.

Bawn bawn

💭
I may be slow to respond.
View GitHub Profile
@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}