Last active
August 29, 2015 14:06
-
-
Save alexcristea/0244b50e503e8bf4f25d to your computer and use it in GitHub Desktop.
Enumerate through all views that are placed under a passed view and get access to each view using a block.
This file contains hidden or 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
#import <UIKit/UIKit.h> | |
@interface UIViewController (BrickExtensions) | |
- (void)enumerateViewsPlacedUnderView:(UIView *)view usingBlock:(void (^)(UIView * view))block; | |
@end |
This file contains hidden or 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
#import "UIViewController+BKBrickExtensions.h" | |
@implementation UIViewController (BrickExtensions) | |
- (void)enumerateViewsPlacedUnderView:(UIView *)view usingBlock:(void (^)(UIView *))block | |
{ | |
for (UIView *underView in self.view.subviews) { | |
if(CGRectContainsRect(view.frame, underView.frame)) | |
block(underView); | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment