繁体   English   中英

iPhone 6/6 +屏幕尺寸问题

[英]iPhone 6/6+ Screen size issue

这真让我抓狂。 完成必要的操作后,在iPhone 6模拟器上,我得到了正确的self.view.bounds {{0, 0}, {375, 667}}但是在实际的iPhone 6设备上,它仍然显示{{0, 0}, {320, 568}} 这是我尝试的:

  1. 更新了Images.xcassets,以包括从6+到iPhone 4的所有设备的启动图像。

  2. 更新了Images.xcassets中的@ 3x图标(180x180),

  3. 甚至尝试使用xib作为启动文件(XCode-> File-> New-> File-> Launch Screen),

但是,尽管它可以在模拟器上运行,但在实际的iPhone 6设备上却全部徒劳。 有任何想法吗 ?

我得到了答案。 问题是我在iPhone 6上使用了Zoomed屏幕。我将其设置回标准位置,边界正确。

当系统首次在设备上启动应用程序时,它将在屏幕上临时显示静态启动图像。 此图像是应用程序的启动图像,它是您在Xcode项目中指定的资源。 启动图像可为用户提供应用程序已启动的即时反馈,同时让您的应用程序有时间准备其初始用户界面。 配置好应用程序的窗口并准备好显示后,系统会换出该窗口的启动映像。

当应用程序用户界面的最新快照可用时,系统会优先使用该映像,而不是使用应用程序的启动映像。 当您的应用程序从前台过渡到后台时,系统会为您的应用程序的用户界面拍摄快照。 当您的应用返回到前景时,它会尽可能使用该图像而不是启动图像。 如果用户杀死了您的应用程序或您的应用程序已长时间没有运行,则系统将丢弃快照并再次依赖您的启动映像。

新的Xcode项目包括应用程序启动图像的图像资产条目。 要添加启动图像,请将相应的图像文件添加到项目的图像资产中。 在构建时,Xcode将适当的密钥添加到应用程序的Info.plist文件中,并将图像放置在应用程序包中。

对于iPhone 6:

750 x 1334 (@2x) for portrait

1334 x 750 (@2x) for landscape

对于iPhone 6 Plus:

1242 x 2208 (@3x) for portrait

2208 x 1242 (@3x) for landscape

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/MobileHIG/LaunchImages.html#//apple_ref/doc/uid/TP40006556-CH22-SW1

这是您的Info.plist的相关位:

<key>UILaunchImages</key>
<array>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{320, 480}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{320, 480}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-568h</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{320, 568}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-568h</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{320, 568}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-667h</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{375, 667}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-667h</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{375, 667}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-736h</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{414, 736}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-736h</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{414, 736}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-Portrait</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{768, 1024}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-Landscape</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{768, 1024}</string>
    </dict>
</array>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM