2011-01-10 74 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 { 

}