Created
March 28, 2012 17:34
-
-
Save johnclayton/2228502 to your computer and use it in GitHub Desktop.
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
- (UITextField *) textField { | |
UITextField *textField = nil; | |
for (id subview in [self subviews]) { | |
if ([subview isKindOfClass:[UITextField class]]) { | |
textField = (UITextField *)subview; | |
break; | |
} | |
} | |
return textField; | |
} | |
- (UIView *) backgroundView { | |
UIView *backgroundView = nil; | |
for (id subview in [self subviews]) { | |
NSString *subviewClassName = NSStringFromClass([subview class]); | |
if ([subviewClassName isEqualToString:@"UISearchBarBackground"]) { | |
backgroundView = (UIView *)subview; | |
break; | |
} | |
} | |
return backgroundView; | |
} | |
- (UIButton *) cancelButton { | |
UIButton *cancelButton = nil; | |
for (id subview in [self subviews]) { | |
NSString *subviewClassName = NSStringFromClass([subview class]); | |
if ([subviewClassName isEqualToString:@"UINavigationButton"]) { | |
if([[(NSObject *)subview performSelector:@selector(title)] isEqualToString:@"Cancel"]) { | |
cancelButton = (UIButton *)subview; | |
break; | |
} | |
} | |
} | |
return cancelButton; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment