2014-10-08 65 views
0

我有一個問題,因爲iOS8和Xcode 6.0.1,我的警報對話框的標題不會出現。所以我改變了我的UIAlertView到UIAlertController,但我有同樣的問題...UIAlertController標題始終爲零與iOS8

我的警報的標題總是爲零,並且顯示非常難看,因爲我沒有serparator行。

你知道我爲什麼這樣嗎?

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]; 

不過這是結果

Alertview without title

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

謝謝。

+0

使用Excat相同的代碼,並在這裏 – 2014-10-08 09:22:56

+0

其工作@Bhumit我在另一個清潔工程測試和正常工作太多,但我不知道這可能是在我的實際項目,UIAlertController衝突... – DamienLevel 2014-10-08 09:36:24

+0

這是我的工作 – 2014-10-08 09:43:54

回答

1

感謝@Myaaoonn,我解決了我的問題!

UIAlertView title does not display

我剛收到我的ViewController 範疇類及其工作菲英刪除以下方法!

- (void)setTitle:(NSString *)title 
{ 
    // My Code 
} 
0

嘗試調用的UIAlertView中是這樣的:

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

是否標題依然沒有顯示?

+0

它仍然不適用於iOS8,但適用於iOS7 ... iOS8結果:http://s9.postimg.org/y176nl6a7/alerti_OS8.png iOS7結果:http:/ /s28.postimg.org/c8n75e7kt/alerti_OS7.png – DamienLevel 2014-10-08 09:29:36