根据苹果公司的要求,我的应用程序必须能够在两种纵向模式下运行。我该如何使用shouldAutorotateToInterfaceOrientation来实现这一点?
根据苹果公司的要求,我的应用程序必须能够在两种纵向模式下运行。我该如何使用shouldAutorotateToInterfaceOrientation来实现这一点?
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
return (orientation != UIDeviceOrientationLandscapeLeft) &&
(orientation != UIDeviceOrientationLandscapeRight);
}
由于上述原因,提交的应用程序被拒绝。该应用程序仅使用纵向(Home键朝下)方向。
“应用程序不符合苹果iOS人机界面指南的要求,这是App Store审核指南所必需的。
具体而言,该应用程序仅支持纵向底部向上的变体,而不支持顶部向上的变体。
虽然支持每个方向的两个变体,且每个变体都有独特的启动图像,可以提供最佳用户体验并得到推荐,但我们理解某些应用程序必须仅在纵向方向上运行。在这种情况下,适当的做法是在您的应用程序中支持该方向的两个变体,例如,Home键朝上和朝下。”
解决方法: 1)
`- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
2) 打开 info.plist 添加一个新的字符串 UILaunchImageFile
并将值插入为 Default-Portrait.png
3) 将 Default.png 更改为 Default-Portrait.png,并复制该文件以重命名为 Default-PortraitUpsideDown.png(将此文件旋转 180 度)
这将启用上下方向的肖像模式,具有相应的启动图像。
确保在应用程序内的所有视图控制器中使用 UIInterfaceOrientationIsPortrait(interfaceOrientation)
,如果需要的话。在运行之前进行清理操作。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}