Skip to content

Instantly share code, notes, and snippets.

@nickdowell
Last active December 24, 2015 09:59
Show Gist options
  • Save nickdowell/6781160 to your computer and use it in GitHub Desktop.
Save nickdowell/6781160 to your computer and use it in GitHub Desktop.
void UIViewRecurse(UIView *view, void (^ apply)(UIView *subview))
{
static void (^ recurse)(UIView *subview, void (^ apply)(UIView *subview)) = nil;
if (recurse == nil)
recurse = ^(UIView *subview, void (^ apply)(UIView *subview)){
apply(subview);
for (UIView *v in subview.subviews)
recurse(v, apply);
};
recurse(view, apply);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment