0

iOS8 および Xcode 6.0.1 以降、アラート ダイアログのタイトルが表示されないという問題があります。だから私は UIAlertView を UIAlertController に変更しましたが、同じ問題があります...

私のアラートのタイトルは常に nil であり、区切り線がないため、表示が非常に醜いです。

なぜ私がこれを持っているか知っていますか?

    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];

    [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
        [self dismissViewControllerAnimated:YES completion:nil];
    }]];

    [self presentViewController:alert animated:YES completion:nil];

でもこれが結果

タイトルのないアラートビュー

(lldb) po alert.title
nil
(lldb) po alert.message
message

ありがとうございました。

4

2 に答える 2

0

次のように UIAlertView を呼び出してみてください。

[[[UIAlertView alloc] initWithTitle:<#title#>
                            message:<#msg#>
                           delegate:nil
                  cancelButtonTitle:<#cancel button#>
                  otherButtonTitles:<#buttons#>,nil] show];

タイトルはまだ表示されませんか?

于 2014-10-08T09:24:06.090 に答える