Skip to content

Instantly share code, notes, and snippets.

@sbrocket
Created May 18, 2011 20:08
Show Gist options
  • Select an option

  • Save sbrocket/979428 to your computer and use it in GitHub Desktop.

Select an option

Save sbrocket/979428 to your computer and use it in GitHub Desktop.
// Version 1
[[self.scrollView subviews] enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) {
[UIView animateWithDuration:0.25 animations:^{
obj.alpha = 0.0;
} completion:^(BOOL finished) {
[obj removeFromSuperview];
}];
}];
// Version 2
NSArray *scrollSubviews = [self.scrollView subviews];
[UIView animateWithDuration:0.25 animations:^{
[scrollSubviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {
view.alpha = 0.0;
}];
} completion:^(BOOL finished) {
[scrollSubviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment