Im trying to implement a way of taking a screenshot in my application. I want the UINavigationBar tip slide up - take the screenshot - and then the UINavigationBar can slide down nice and easy. I need the app to wait/hold a few seconds between some lines of code, because this way the first animation does not get time to finish:
[self.navigationController setNavigationBarHidden:YES animated:YES ];
[self.navigationController setNavigationBarHidden:NO animated:YES];
So, is there a way of delaying execution, like when animation a button like so:
[UIView animateWithDuration:0.5 delay:3 options:UIViewAnimationOptionCurveEaseOut animations:^{self.myButton.frame = someButtonFrane;} completion:nil];
regards
You can use:
double delayInSeconds = 2.0; // number of seconds to wait
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
/***********************
* Your code goes here *
***********************/
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With