Skip to content

Instantly share code, notes, and snippets.

@rcfrias
Created October 7, 2014 20:12
Show Gist options
  • Save rcfrias/aaca74180428ab9b0b4b to your computer and use it in GitHub Desktop.
Save rcfrias/aaca74180428ab9b0b4b to your computer and use it in GitHub Desktop.
Getting the Top-most View Controller on an iOS Application
UIViewController *topViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
while (topViewController.presentedViewController) {
topViewController = topViewController.presentedViewController;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment