【发布时间】:2010-04-27 13:46:32
【问题描述】:
根据苹果的说法,我的应用程序必须能够在两种纵向模式下运行。如何使用 shouldAutorotateToInterfaceOrientation 完成此操作?
【问题讨论】:
标签: xcode ipad orientation portrait
根据苹果的说法,我的应用程序必须能够在两种纵向模式下运行。如何使用 shouldAutorotateToInterfaceOrientation 完成此操作?
【问题讨论】:
标签: xcode ipad orientation portrait
无论界面方向如何,都只返回 YES。这将允许系统自动旋转到倒置方向。
如果您不想支持横向,则返回:
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
【讨论】:
此代码允许除横向以外的任何方向:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
return (orientation != UIDeviceOrientationLandscapeLeft) &&
(orientation != UIDeviceOrientationLandscapeRight);
}
【讨论】:
提交的应用因上述原因被拒绝。应用仅使用纵向(Home Button Down)方向。
”应用程序不符合 Apple iOS 人机界面指南,如 App Store 审核指南所要求的。
具体来说,应用只支持自下而上的纵向变体,不支持自上而上的变体。
虽然支持两种方向的两种变体,每种都具有独特的启动图像,但可以提供最佳的用户体验并被推荐,但我们了解某些应用程序必须仅在纵向运行。在这种情况下,在您的应用程序中支持该方向的两种变体是合适的,例如,主页按钮向上和向下。”
解决。 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)。运行前也要进行清洁。
【讨论】:
使用这个。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
【讨论】: