Created
February 4, 2013 23:04
-
-
Save chrisallick/4710587 to your computer and use it in GitHub Desktop.
Run a piece of code after a delay. I'm sure an Objective-C nerd loses it's wings every time i use this, but god damn is that useful as shiiiiit. Even worse, im iterating over subviews to destroy them.
This file contains 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
double delayInSeconds = 1.0; | |
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | |
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | |
//code to be executed on the main queue after delay | |
sendButton.frame = CGRectMake(0, self.view.frame.size.height-(191*.5), 640*.5, 191*.5); | |
CGRect frame = sendingLabel.frame; | |
frame.origin.y = -30 - frame.size.height; | |
[sendingLabel setFrame:frame]; | |
for (id subview in self.view.subviews) { | |
if ([subview isMemberOfClass:[FillCircle class]]) { | |
[subview removeFromSuperview]; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment