iOS 应用程序横向模式启动图像未显示



我正在开发一个只在横向模式下的iOS应用程序。我将启动屏幕图像加载为:Default@2x.png、默认568h@2x.png、默认667h@2x.png、默认736h@3x.png。

问题是,每当我在iPhone6或6 +中启动该应用程序时,它都会从iphone5获取屏幕尺寸。

附言我尝试使用Images.Xcasset,但它不适用于iPhone<6。

谢谢。

阅读 Apple 提供的 iOS 人机界面指南,并确认您的所有图像是否为所需尺寸。还要通过图像命名约定是否合适。

因为启动图像应根据设备及其方向自动拾取。

这是链接:

https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html#//apple_ref/doc/uid/TP40006556-CH27-SW2

如果您的应用程序仅横向,则必须在应用程序设置的常规选项卡中的"设备方向"部分选中"纵向"选项。然后,您需要为所有视图控制器设置方向:

-(BOOL)shouldAutorotate
{
    return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeLeft |
    UIInterfaceOrientationMaskLandscapeRight;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return  UIInterfaceOrientationLandscapeLeft;
}

在 Images.xcassets 中,您需要放置 iOS 7 和 8 的所有图像。之后,该应用程序将使用正确的启动图像启动。请注意,preferredInterfaceOrientationForPresentation必须等效于启动图像方向。

最新更新