Skip to content

Commit

Permalink
Fix "Parent Forum" button on iPad.
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanw committed Jan 3, 2014
1 parent 3cc3a2b commit f99f706
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Source/URLs/AwfulURLRouter.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,16 @@ - (BOOL)jumpToForum:(AwfulForum *)forum

- (BOOL)selectTopmostViewControllerContainingViewControllerOfClass:(Class)class
{
if (![self.rootViewController respondsToSelector:@selector(viewControllers)]) return NO;
if (![self.rootViewController respondsToSelector:@selector(setSelectedViewController:)]) return NO;
for (UIViewController *topmost in [self.rootViewController valueForKey:@"viewControllers"]) {
UIViewController *root = self.rootViewController;
if ([root isKindOfClass:[AwfulExpandingSplitViewController class]]) {
AwfulExpandingSplitViewController *split = (AwfulExpandingSplitViewController *)root;
root = split.viewControllers.firstObject;
}
if (![root respondsToSelector:@selector(viewControllers)]) return NO;
if (![root respondsToSelector:@selector(setSelectedViewController:)]) return NO;
for (UIViewController *topmost in [root valueForKey:@"viewControllers"]) {
if (FindViewControllerOfClass(topmost, class)) {
[self.rootViewController setValue:topmost forKey:@"selectedViewController"];
[root setValue:topmost forKey:@"selectedViewController"];
return YES;
}
}
Expand Down

0 comments on commit f99f706

Please sign in to comment.