2012-05-14 55 views
1

不平衡的調用開始/結束外觀轉換我在我的iPad應用程序上使用splitViewController,但在此之前,我有一個登錄名和成功驗證身份時刷新根和詳細信息視圖。問題是,一旦我加載主視圖沒有任何反應,我嘗試通過推動任何意見,並沒有事件。對於<RevealController:0xe9069b0>

雖然我有模式加載登錄查看我得到這個錯誤:「不平衡的呼叫開始/結束的外觀轉換爲

我用這個做登錄視圖中MAINVIEW(frontViewController):

-(void)displayLoginView:(BOOL)animated{ 
LoginView *loginController = [[LoginView alloc] initWithNibName:@"LoginView" bundle:nil]; 
[self presentModalViewController:loginController animated:YES]; 

}

- (void)viewDidLoad{ 
[super viewDidLoad]; 

//Add logout button 

self.navigationItem.rightBarButtonItem = [[ALLOC的UIBarButtonItem] initWithTitle:@ 「註銷」 樣式:UIBarButtonItemStyleBordered目標:自我行動:@選擇器(註銷)]; //如果尚未登錄,則顯示登錄視圖 [self displayLoginView:NO]; }

-(void)logout{ 
[self displayLoginView:YES]; 

}

和appdelegate.m:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 

FrontViewController *frontViewController; 

RearViewController *rearViewController; 

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){ 

frontViewController = [[FrontViewController alloc]   initWithNibName:@"FrontViewController_iPhone" bundle:nil]; 

rearViewController = [[RearViewController alloc] initWithNibName:@"RearViewController_iPhone" bundle:nil]; 
} 
else{ 
    frontViewController = [[FrontViewController alloc] initWithNibName:@"FrontViewController_iPad" bundle:nil]; 

    rearViewController = [[RearViewController alloc] initWithNibName:@"RearViewController_iPad" bundle:nil]; 
} 

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController]; 
    RevealController *revealController = [[RevealController alloc] initWithFrontViewController:navigationController rearViewController:rearViewController]; 
self.viewController = revealController; 
self.window.rootViewController = self.viewController; 
[self.window makeKeyAndVisible]; 
return YES; 

}

有沒有人能幫助我嗎?

非常感謝!

回答

13

檢查你的viewWillAppear:animated:, viewDidAppear:animated:, viewWillDisappear:animated:, and viewDidDisappear:animated:方法,要麼你不執行它們,要麼你必須調用[super viewDid ....]。 我有相同的pb,原因是shouldAutoRotateToInterfaceOrientation:其中一個返回false而其他人返回true,我將它們設置爲返回相同的值。

+2

我完全忘記了在這兩種方法中調用超級...我有一個帶有嵌入式導航控制器的tabBarController,並且在tabBarController中,我已經覆蓋了viewWillAppear和viewDidAppear,但沒有調用[super viewWillAppear]和[super viewDidAppear ],這就是導致這個消息出現的原因,也是動畫不平滑。感謝Abzamon,我希望你能很快接受你的答案:) – Roger

+0

我曾經*和Roger一樣有問題。感謝Abzamon,這固定了它! – matsr

+2

不是正確答案。被稱爲未被接收到正確的外觀程序的被調用者更加關注查看外觀。 –

相關問題