3

根据苹果的说法,我的应用程序必须能够在两种纵向模式下运行。如何使用 shouldAutorotateToInterfaceOrientation 完成此操作?

4

4 回答 4

8

无论界面方向如何,都只需返回 YES。这将允许系统自动旋转到倒置方向。

如果您不想支持横向,则返回:

return UIInterfaceOrientationIsPortrait(interfaceOrientation);
于 2010-04-27T13:49:39.567 回答
6

此代码允许除横向之外的任何方向:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
    return (orientation != UIDeviceOrientationLandscapeLeft) &&
           (orientation != UIDeviceOrientationLandscapeRight);
}
于 2010-04-27T13:53:42.490 回答
1

由于上述原因,提交的应用程序被拒绝。应用仅使用纵向(Home Button Down)方向。

" 应用程序不符合 App Store 审查指南所要求的 Apple iOS 人机界面指南。

具体来说,app 仅支持纵向的自下而上变体,但不支持自上而上变体。

虽然支持两种方向的两种变体,每种都有独特的启动图像,提供最佳的用户体验并被推荐,但我们了解某些应用程序必须仅在纵向运行。在这种情况下,在您的应用程序中支持该方向的两种变体是合适的,例如,主页按钮向上和向下。”

来解决。1)

 `- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}

2) 打开 info.plist 添加一个新字符串UILaunchImageFile & insert value as Default-Portrait.png

3) 将 Default.png 更改为 Default-Portrait.png 并复制文件以重命名 Default-PortraitUpsideDown.png(将此文件旋转 180 度)

这可以使用各自的启动图像启用上下纵向。

如果需要,请确保在应用程序内的所有视图控制器中使用 UIInterfaceOrientationIsPortrait(interfaceOrientation)。运行前也要进行清洁。

于 2011-09-30T05:20:04.047 回答
1

用这个。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
于 2012-08-31T14:08:32.753 回答