Skip to content

Instantly share code, notes, and snippets.

@looping
Last active August 29, 2015 13:58
Show Gist options
  • Save looping/10115779 to your computer and use it in GitHub Desktop.
Save looping/10115779 to your computer and use it in GitHub Desktop.
- (id)fromViews:(NSArray *)views findViewWithClass:(Class)viewClass;
- (id)fromViews:(NSArray *)views findViewWithClass:(Class)viewClass {
id retView = nil;
for (UIView * subView in views) {
if ([subView isKindOfClass:[UIAlertView class]]) {
retView = subView;
break;
} else {
if ([subView.subviews count]) {
retView = [self fromViews:subView.subviews findViewWithClass:viewClass];
}
}
}
return retView;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment