Skip to content

Instantly share code, notes, and snippets.

@nurey
Created January 19, 2012 03:38
Show Gist options
  • Save nurey/1637624 to your computer and use it in GitHub Desktop.
Save nurey/1637624 to your computer and use it in GitHub Desktop.
[successDialog hideAfterDelay:1.5f withCompletion: ^
{
[self doSomething];
}];
- (void)hideWithCompletion: (void (^)())completion
{
if (self.visible == YES)
{
[UIView animateWithDuration: 0.33f
delay: 0.0f
options: UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction
animations: ^
{
self.alpha = 0.0f;
}
completion: ^(BOOL finished)
{
[self removeFromSuperview];
completion();
}];
}
}
- (void)hideAfterDelay: (CGFloat)delay
withCompletion: (void (^)())completion
{
[self performSelector: @selector(hideWithCompletion:)
withObject: completion
afterDelay: delay];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment