0

iOS 7.1 の UIAlertView を使用してアプリケーションにいくつかのアラートを表示すると、iOS 8 で完全に動作しますが、アラートは表示されますが、キャンセル、OK などのボタンが表示されません。画面、アプリケーションを閉じる必要があります。

iOS UIAlertController 8 の UIAlertView と以前のバージョンを実装しようとしました。以下のコードを参照してください。

if ([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0) {
            UIAlertView *alerta = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"s000xS2", @"Alerta") message:NSLocalizedString(@"s000xS40", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"s000xS34", @"Não") otherButtonTitles:NSLocalizedString(@"s000xS35", @"Sim"), nil];

            [alerta show];
        }else{
            UIAlertController * alert=   [UIAlertController
                                          alertControllerWithTitle:NSLocalizedString(@"s000xS2", @"Alerta")
                                          message:NSLocalizedString(@"s000xS40", nil)
                                          preferredStyle:UIAlertControllerStyleAlert];

            UIAlertAction* sim = [UIAlertAction
                                 actionWithTitle:NSLocalizedString(@"s000xS35", @"Sim")
                                 style:UIAlertActionStyleDefault
                                 handler:^(UIAlertAction * action)
                                 {
                                     [Util abrirSite:[[[Player sharedPlayer] emissora] site]];
                                     [alert dismissViewControllerAnimated:YES completion:nil];

                                 }];
            UIAlertAction* nao = [UIAlertAction
                                  actionWithTitle:NSLocalizedString(@"s000xS34", @"Não")
                                  style:UIAlertActionStyleDefault
                                  handler:^(UIAlertAction * action)
                                  {
                                      [alert dismissViewControllerAnimated:YES completion:nil];

                                  }];

            [alert addAction:sim];
            [alert addAction:nao];


            [self presentViewController:alert animated:NO completion:nil];
        }

このコードでは同じ問題が発生します。アラートにボタンが表示されません。これを回避するための提案はありますか?

国際化のために文字列を使用していることに注意してください。通常は機能し、文字列を直接 (@ "...") 配置することで既にテストされていますが、機能しませんでした。

4

1 に答える 1