サインイン ボタンとサインアップ ボタンをホストするログイン画面を備えたアプリがあり、インターネットに接続できないことを検出した場合は到達可能性を使用して、カバー ビューを表示してこれらのボタンを非表示にします
self.coveringview
ここで、このビューのアルファで再生する簡単なアニメーションを実行します。それが完了したら、alertview をポップアップしてユーザーに何が起こるかを伝えたいと思います。このコードでは、alert.show をanimatewithduration の完了ブロック。
bahvior は私が望むものではありません。表示したいフェードアウトをユーザーに表示せずにアラートがあまりにも速くポップアップします。どうすればよいですか?
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;
}];
}