Created
April 15, 2012 03:08
-
-
Save taberh/2389665 to your computer and use it in GitHub Desktop.
find view with view name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(UIView *)findView:(UIView *)view withName:(NSString *)name{ | |
Class cl = [view class]; | |
NSString *desc = [cl description]; | |
if ([desc compare:name] == NSOrderedSame) | |
return view; | |
for (int i = 0; i < [view.subviews count]; i++) | |
{ | |
UIView *subView = [view.subviews objectAtIndex:i]; | |
subView = [self findView:subView withName:name]; | |
if (subView) return subView; | |
} | |
return nil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment