2013-04-22 28 views
0

如何在警報中點擊「確定」直接將用戶指向另一個視圖?在UIAlert關閉後載入新視圖

感謝

+1

在Xcode中,你不能,除非你以某種方式獲得的Xcode的源代碼,並重新編譯我t修改了該部分。 – 2013-04-22 17:15:58

+0

我刪除了問題中的Xcode引用,因爲它與問題無關。 – sosborn 2013-04-22 17:22:39

回答

2

設置UIAlertViewDelegatedelegate在你viewController.h文件

不要忘記設置而委託初始化UIAlertView中對象

然後實現在您.m文件下面的方法,寫你的重定向代碼在它

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex // after animation 
{ 
    // Your redirect code goes here 
} 
+0

我試過這個重定向代碼,但沒有工作......任何想法爲什麼? ViewController * sec = [[ViewController alloc] initWithNibName:nil bundle:nil]; [self presentViewController:sec animated:YES completion:nil]; – user2308343 2013-04-22 19:19:09

+0

定義nib名稱,你傳遞零,那麼它將如何識別加載哪一個nib – 2013-04-22 19:21:04

+0

請原諒我的新手,但我如何設置主視圖控制器的nib名稱(這是我試圖加載的視圖)。 – user2308343 2013-04-22 19:27:11