2011-01-10 68 views
3

我正在開發一款應用程序,當設備旋轉到橫向時,需要在風景中顯示覆蓋流式樣視圖。我以前曾經在一些應用上工作過,但他們都不需要風景/旋轉,所以我沒有經驗過。我有代碼來繪製coverflow視圖,但呈現它是艱難的。設備旋轉時,如何顯示風景覆蓋流風格視圖?

我想要的基本上就像iPod應用程序在顯示coverflow時所做的一樣。底部的視圖不旋轉,但頂部的頂部漸變,當旋轉回肖像時淡出。

我猜這件事情做shouldAutorotateToInterfaceOrientation和模態的視圖被提出以淡入淡出過渡,或者利用該技術在這裏找到:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/22285-replicating-cool-ipod-landscape-transition-iphone.html

我想我的主要問題是模態視圖呈現,但它的內容不旋轉到風景。我該怎麼辦?

這是我現在使用的代碼:

父視圖

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ 
NSLog(@"rotating?"); 
if (interfaceOrientation == UIInterfaceOrientationPortrait) { 
    return YES; 
} 
if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)) { 
    NSLog(@"rotating"); 
    CoverFlowViewController *coverFlowView = [[CoverFlowViewController alloc] init]; 
    [coverFlowView setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; 
    [self presentModalViewController:coverFlowView animated:YES]; 
    [coverFlowView release]; 
} 
return YES; 

}

模式的看法

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
NSLog(@"rotating? going back?"); 
if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)) { 
    return YES; 
} else { 
    [self.parentViewController dismissModalViewControllerAnimated:YES]; 
} 
return NO; 

}

+0

我想知道這個問題,以及... – 2011-01-10 06:09:09

回答

1

你應該做的過渡裏面:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 

}