2009-09-15 80 views
0

這是我的問題: - 我有一個navcontroller,裏面有一個帶4視圖控制器的tabbar控制器。 - 我想增加以下功能: - 在landscapeRight辭退navcontroller,的TabBar控制器以及一切和加載全新的控制器 - 這種人去好了,這裏是代碼:從水平視圖切換導致iPhone應用程序崩潰

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
{ 
    MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate]; 
    // Just delete the lines for the orientations you don't want to support 
    if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) { 
      [appDelegate ToHorizontalAverageResponseView:self]; 
    } 
    return YES; 
} 

這裏是在代碼應用委託:

- (void)ToHorizontalAverageResponseView:(id)sender 
{ 
    HorizontalResponseViewController *tempController = [[HorizontalResponseViewController alloc] initWithNibName:nil bundle:nil]; 
    [self setHorizontalResponseViewController: tempController]; 
    [tempController release]; 
    //[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight; 
    // View rotation transformation 
    CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(M_PI * 90.0/180.0); 
    [[horizontalResponseViewController view] setTransform:landscapeTransform]; 

    [window addSubview:[horizontalResponseViewController view]]; 
} 

問題是如何轉回到縱向視圖和所有那些導航欄和標籤欄控制器?

THX, 姆拉登

回答

0

這聽起來像你正在試圖建立沿與iPod的CoverFlow過渡線的東西。在斯坦福大學的CS193P講座中提出了一個問題(關於如何構建覆蓋流效應),並在以下方面提供了答案:

如果您可以承擔內存開銷,那麼添加新的橫向視圖可能是最好的在所有的portait視圖之上(而不是像你所建議的那樣丟棄它們)。用戶然後根據需要與該橫向視圖進行交互,直到返回肖像。所有這一次,肖像的意見都保持在背景中。

+0

我不記得它是哪一個講座,但它是前六個之一。他們可以在iTunes U上找到視頻。 – Hauke 2009-09-16 12:22:21