Skip to content

Instantly share code, notes, and snippets.

@paweldudek
Created June 21, 2014 16:19
Show Gist options
  • Save paweldudek/fdfb7bbe72720ab33f5d to your computer and use it in GitHub Desktop.
Save paweldudek/fdfb7bbe72720ab33f5d to your computer and use it in GitHub Desktop.
-(UIButton *)specsFindButtonInSubviewsWithTitle:(NSString *)title {
NSPredicate *buttonPredicate = [NSPredicate predicateWithBlock:^BOOL(UIView *view, NSDictionary *bindings) {
return [view isKindOfClass:[UIButton class]] && [[view accessibilityLabel] isEqualToString:title];
}];
return [[self.subviews filteredArrayUsingPredicate:buttonPredicate] firstObject];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment