根据apple,我的应用程序必须能够以两种肖像模式运行。如何使用shouldAutorotateToInterfaceOrientation ??
完成此操作答案 0 :(得分:8)
无论接口方向是什么,只需返回YES。这将允许系统自动旋转到倒置方向。
如果您不想支持横向方向,请返回:
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
答案 1 :(得分:6)
此代码允许除横向以外的任何方向:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
return (orientation != UIDeviceOrientationLandscapeLeft) &&
(orientation != UIDeviceOrientationLandscapeRight);
}
答案 2 :(得分:1)
由于上述原因,已提交的应用被拒绝。应用程序仅使用纵向(Home Button Down)方向。
“应用不符合Apple iOS人机界面指南,符合App Store审核指南的要求。
具体来说,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),如果需要的话。在跑步之前也做一个干净。
答案 3 :(得分:1)
使用此功能。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}