2013-06-05 77 views
1

背景SPLITVIEW取向的問題。(縱向模式)

我有iPad SPLITVIEW application.The分割視圖是爲了在窗的rootview控制器需要的登錄畫面的應用程序,因此我目前它像因此:[self.splitViewController presentViewController:self.loginView animated:NO completion:nil];。我在主視圖上有一個彈出窗口,它錨定到導航欄UIBarButtonItem,幫助用戶註銷。這是gr8的工作。

問題

我需要支持兩個取向等主視圖具有在縱向模式作爲well.The第一個問題我面對要被示出的是用戶註銷在肖像的應用程序的時模式,主視圖沒有被駁回,登錄視圖被呈現時,主視圖仍然visible.I管理通過像這樣的左邊欄按鈕複製敲打事件解決這個問題:

[self.detailViewController.navigationItem.leftBarButtonItem.target performSelector:self.detailViewController.navigationItem.leftBarButtonItem.action]; 

這引起到第二個問題。 當我註銷的時候,masterview被上面的代碼片段正確地解散了,並且loginview被看到了。但是現在,如果我改變了我的方向爲橫向並且再次登錄,那麼主視圖被一個黑條代替(​​與masterview的寬度相等)。我估計該splitview仍然認爲它在portarit視圖和方向更改不傳播到splitviewcontroller。任何人都可以請幫我解決這個問題。

什麼我迄今所做

我試着顯式調用-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration與對的DetailView更新的方向,但沒有奏效。

我將應用程序的rootview控制器重置爲在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions中創建的同一個splitviewcontroller實例,希望這可以用作刷新,但它沒有注意。

我不知道該從哪裏出發。 重要說明:我在iOS 6.0。任何幫助都非常感謝。

回答

0

嗯,我通過改變主視圖

- (void)showMasterView 
{ 
    if (!self.masterIsVisible) 
    { 
     self.masterIsVisible = YES; 
     NSArray *controllers = self.splitViewController.viewControllers; 
     UIViewController *rootViewController = [controllers objectAtIndex:0]; 

     UIView *rootView = rootViewController.view; 
     CGRect rootFrame = rootView.frame; 
     rootFrame.origin.x += rootFrame.size.width; 

     [UIView beginAnimations:@"showView" context:NULL]; 
     rootView.frame = rootFrame; 
     [UIView commitAnimations]; 
    } 
} 

- (void)hideMasterView 
{ 
    if (self.masterIsVisible) 
    { 
     self.masterIsVisible = NO; 
     NSArray *controllers = self.splitViewController.viewControllers; 
     UIViewController *rootViewController = [controllers objectAtIndex:0]; 

     UIView *rootView = rootViewController.view; 
     CGRect rootFrame = rootView.frame; 
     rootFrame.origin.x -= rootFrame.size.width; 

     [UIView beginAnimations:@"hideView" context:NULL]; 
     rootView.frame = rootFrame; 
     [UIView commitAnimations]; 
    } 
} 

這隻會在肖像模式發生的起源固定它。 Thanks to...。附:

PS:誠摯的道歉,不要提前發佈此答案。問題解決後,我完全忘記了它。現在修補我的錯誤:)

相關問題