我看明白「最好」的方法,從A或B過渡到的UITabBarController d(在我的應用程序的主界面) - 通過C.
有條件去含義我希望以下所有內容均有效。
A -> C -> D
A -> B -> C -> D
A -> B -> D
A -> D
C是一個模式對話框,基本上詢問了一塊丟失信息的用戶,如果他們沒有在他們的個人資料設置。
我已經試過:
使用觸發模式賽格瑞從d - >下,在d的viewDidLoad中功能:
([self performSegueWithIdentifier:@"ShowNumberDialog" sender:self];)
編程方式顯示C作爲在d模態在viewDidLoad中功能:
(void)viewDidLoad { [super viewDidLoad]; NSString *deviceNumber = [[UserModel sharedSingleton] deviceNumber]; if ([deviceNumber isEqual:[NSNull null]]) { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"NumberDialog"]; [vc setModalPresentationStyle:UIModalPresentationFullScreen]; NSLog(@"Showing device number dialog"); [self presentModalViewController:vc animated:NO]; } }
這些以及我所做的其他「黑客」嘗試似乎都在起作用。所以我認爲我不瞭解我應該這樣做的基本原理。有人可以推薦更好的方法嗎?
這工作完美,謝謝! – amirpc 2012-08-05 23:52:38
很高興工作!如果你不這樣做,你應該檢查XCode調試器的輸出窗口。您可能會注意到「無法在推送另一個視圖時推送視圖」或類似內容的消息。有時輸出窗口很有幫助! – 2012-08-06 02:11:01