You can use NSPredicate to define a rule to select the items you want. Note I'm using isKindOfClass
, and not isMemberOfClass
, since the former takes class hierarchy into account, and will be able to identify subclasses of the class you are looking for.
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"self isKindOfClass: %@", [targetClass class]];
NSArray* filteredViews= [parentView.subviews filteredArrayUsingPredicate:predicate];