簡體   English   中英

UIAlertView不顯示

[英]UIAlertView does not show up

看下面的代碼,問題是即使我在調試中看到代碼已執行,AlertView也不會顯示。

請指教。

非常感謝

伊蘭

    -(void)displayABC:(id)sender
{

    static int index = 0;
    NSString *path = [[NSBundle mainBundle] pathForResource:@"ABC" ofType:@"plist"];
    NSArray *ABCArray = [NSArray arrayWithContentsOfFile:path];
    if(index < [ABCArray count])
        [authButton setTitle:[ABCArray objectAtIndex:index] forState:UIControlStateNormal];
    index++;


    if (index > [ABCArray count]){

        UIAlertView *endOfABCAlertView = [[UIAlertView alloc] initWithTitle:@"XXX" message:@"XXX" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
        [self.view addSubview:endOfABCAlertView];

    }
}

我正在使用最新的Xcode 4.6.3(這是模擬器的錯誤嗎?也許嗎?)

您不是在打電話:

[endOfABCAlertView show];

如果您可以花3分鍾時間查看Apple文檔中的標題Displaying ,您將找到它。

[endOfABCAlertView show]是顯示它的方法。 不要將其添加為子視圖。

編輯:檢查哪些按鈕被取消的方法是通過使用UIAlertViewDelegate協議。 有關詳細信息,請參閱文檔

刪除[self.view addSubview:endOfABCAlertView] ; 並添加[endOfABCAlertView show]; 那會..

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM