所以我有一個的UITabBarController應用程序,我想顯示一個登錄頁面,我也這樣做:駁回modalViewController
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDidLogin:) name:UserDidLoginNotification object:nil];
LoginViewController* loginViewController = [[LoginViewController alloc] init];
self.tabBarController.selectedViewController = [self.tabBarController.viewControllers objectAtIndex:0];
[self.tabBarController.selectedViewController presentModalViewController:loginViewController animated:NO];
[loginViewController release];
裏面我LoginViewController我也顯示另一個modalViewController:
- (void) twitterLogin: (UIViewController *) askingView
{
UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _twitter delegate: self];
if (controller) {
self.askingView = askingView;
[askingView presentModalViewController: controller animated: YES];
}
}
我有以下方法,其中askView是LoginViewController, 當我想解僱我這樣做:
[self.askingView dismissModalViewControllerAnimated:YES];
[[NSNotificationCenter defaultCenter] postNotificationName:UserDidLoginNotification object:nil];
但是,這並不關閉LoginViewController並顯示UITabBarController視圖..它只是駁回了我的modalViewController顯示從LoginvVIewController。我在這裏做錯了什麼?我也收到以下錯誤:
attempt to dismiss modal view controller whose view does not currently appear. self = <LoginViewController: 0x2aff70> modalViewController = <SA_OAuthTwitterController: 0x2d2a80>
2011-09-16 09:45:37.750 VoteBooth[4614:707] attempt to dismiss modal view controller whose view does not currently appear. self = <MainViewController: 0x29fec0> modalViewController = <LoginViewController: 0x2aff70>
這工作得很好,直到我升級到最新的Xcode和iOS 5上我的iPhone 3GS,有什麼想法? – topace
嘗試更改'presentsViewController'的'parentViewController'引用。這似乎對我有用。 – superjessi
是的你是對的。現在我正在檢查哪個IOS,然後決定要做什麼。 – topace