- Iterate over all subviews of a specific type
- @implementation Util
- + (void)iterateOverSubviewsOfType:(Class)viewType
- view:(UIView*)view
- blockToExecute:(void (^)(id subview))block
- {
- for (UIView* subview in view.subviews) {
- if ([subview isKindOfClass:viewType]) {
- block(subview);
- }
- }
- }
- @end
- for (id subview in view.subviews) {
- if ([subview isMemberOfClass:viewType]) {
- block(subview);
- }
- }