I have an app with a login screen that hosts a sign in button and a sign up button, using reachibility if I detect that I can't reach the internet I hide those buttons by showing a covering view
self.coveringview
Now I do some simple animation playing with the alpha of this view, once that is done, I want an alertview to popup to tell the user what happen, in this code you can see I am doing that by having the alert.show in the completion block of the animatewithduration.
the bahvior is not what I want, the alert pops up too fast without showing the user the fade out I want it to show, what can I do?
NetworkStatus netStatus = [reachability currentReachabilityStatus];
if(netStatus == NotReachable) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection"
message:@"Unable to connect to the server.
Please check your internet connection and try again."
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"OK", nil];
[UIView animateWithDuration:1.0
animations:^{
self.coveringView.alpha = 1.0;
}completion:^(BOOL finished) {
// this is the problem here, I need to make this alert show up after
the fade out occurs completely
[alert show];
self.coveringView.hidden = NO;
}];
}
else {
[UIView animateWithDuration:1.0
animations:^{
self.coveringView.alpha = 0.0;
}completion:^(BOOL finished) {
self.coveringView.hidden = YES;
}];
}