Skip to content

Instantly share code, notes, and snippets.

View zengyun-hacker's full-sized avatar
🎯
Focusing

Zeng Yun zengyun-hacker

🎯
Focusing
  • Alibaba Inc
  • Hangzhou, Zhejiang, China
View GitHub Profile
@zengyun-hacker
zengyun-hacker / gist:2c0eb3515f2ebf850e22
Created October 16, 2015 08:39 — forked from snikch/gist:3661188
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;
}