当设备旋转时,如何显示横向 coverflow 样式视图?

发布于 2024-10-11 04:26:37 字数 1731 浏览 7 评论 0原文

我正在开发一个应用程序,当设备旋转到横向时,需要在横向显示 coverflow 样式视图。我之前开发过一些应用程序,但它们都不需要横向/旋转,所以我没有经验。我有绘制封面流视图的代码,但事实证明呈现它很困难。

我想要的基本上就像 iPod 应用程序在显示 coverflow 时所做的那样。下面的视图不会旋转,但封面流会在顶部淡入,并在旋转回纵向时淡出。

我猜这与 shouldAutorotateToInterfaceOrientation 和淡入淡出过渡呈现的模态视图有关,或者使用此处找到的技术:

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

我想我的主要问题是呈现了模式视图,但它的内容没有旋转为横向。我应该怎么办?

这是我现在使用的代码:

PARENT VIEW

- (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;

}

MODAL VIEW

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

}

I'm working on an app that will need to display a coverflow style view in landscape when the device is rotated to landscape orientation. I've worked on a few apps before, but none of them required landscape/rotation so I'm not experienced with it. I have the code to draw the coverflow view, but presenting it is proving tough.

What I'd like is basically like what the iPod app does when displaying coverflow. The view underneath does not rotate, but the coverflow fades in on top, and fades out when rotated back to portrait.

I'm guessing it's something to do with shouldAutorotateToInterfaceOrientation and a modal view being presented with a fade transition, or using the technique found here:

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

I guess my main problem is that the modal view is presented, but it's contents are not rotated to landscape. What should I do?

Here's the code I'm using now:

PARENT VIEW

- (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;

}

MODAL VIEW

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

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱殇璃 2024-10-18 04:26:37

你应该在里面进行转换:

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

}

You should do the transition inside:

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

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文