我正在开发一个应用程序,当设备旋转到横向时,需要在横向显示coverflow样式的视图。我以前开发过一些应用程序,但它们都不需要横向/旋转,所以我没有使用经验。我有绘制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;}
发布于 2011-03-05 03:06:04
您应该在内部进行转换:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
}https://stackoverflow.com/questions/4644130
复制相似问题