我有一個UIAlertView有按鈕「確定」和「取消」。我想在按下按鈕OK
時顯示模式視圖控制器。這是我迄今爲止所做的:UIAlertView +模態視圖控制器不起作用
- 創建UIAlertView框。實現了UIAlertViewDelegate協議。實施
(void)alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)buttonIndex
方法。 在上述方法中,當
buttonIndex == 0
,我試圖做一些事情的影響:if (buttonIndex == 0) { ModalViewController *mdvc = [[[ModalViewController alloc] initWithNibName:nil bundle:nil] autorelease]; [self presentModalViewController:mdvc animated:YES]; }
事實證明,模態視圖不存在本身。我嘗試了許多其他方法,但它們只是使它變得複雜,並使我創建了大量不必要的變量。必須有一個更簡單的方法。
一些額外的信息:
- 如果反正重要的,這是一個OpenGL ES應用程序。
- 如果我調用[self presentModalController:]作爲UIButton按下的結果,它確實按預期工作 - 我看到了模式視圖控制器。
我已經試過這個方法,它似乎沒有工作。但是,如果我通過UIButton按鈕調用presentModalController,它確實按預期工作 - 我看到了模式視圖控制器。 – Ravi