简体   繁体   English

iPhone 6/6 +屏幕尺寸问题

[英]iPhone 6/6+ Screen size issue

This is driving me crazy. 这真让我抓狂。 After doing the necessary things, on iPhone 6 simulator, I am getting correct self.view.bounds {{0, 0}, {375, 667}} but on the actual iPhone 6 device it is still showing {{0, 0}, {320, 568}} . 完成必要的操作后,在iPhone 6模拟器上,我得到了正确的self.view.bounds {{0, 0}, {375, 667}}但是在实际的iPhone 6设备上,它仍然显示{{0, 0}, {320, 568}} Here is what I tried : 这是我尝试的:

  1. Updated Images.xcassets to include launch images for all devices starting from 6+ down to iPhone 4, 更新了Images.xcassets,以包括从6+到iPhone 4的所有设备的启动图像。

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

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

But all in vain on actual iPhone 6 device, though it works on simulator. 但是,尽管它可以在模拟器上运行,但在实际的iPhone 6设备上却全部徒劳。 Any ideas ? 有任何想法吗 ?

I got the answer. 我得到了答案。 The issue was I was using Zoomed display on iPhone 6. I set it back to standard and the bounds were correct. 问题是我在iPhone 6上使用了Zoomed屏幕。我将其设置回标准位置,边界正确。

When the system launches an app for the first time on a device, it temporarily displays a static launch image on the screen. 当系统首次在设备上启动应用程序时,它将在屏幕上临时显示静态启动图像。 This image is your app's launch image and it is a resource that you specify in your Xcode project. 此图像是应用程序的启动图像,它是您在Xcode项目中指定的资源。 Launch images provide the user with immediate feedback that your app has launched while giving your app time to prepare its initial user interface. 启动图像可为用户提供应用程序已启动的即时反馈,同时让您的应用程序有时间准备其初始用户界面。 When your app's window is configured and ready to be displayed, the system swaps out the launch image for that window. 配置好应用程序的窗口并准备好显示后,系统会换出该窗口的启动映像。

When a recent snapshot of your app's user interface is available, the system prefers the use of that image over the use of your app's launch images. 当应用程序用户界面的最新快照可用时,系统会优先使用该映像,而不是使用应用程序的启动映像。 The system takes a snapshot of your app's user interface when your app transitions from the foreground to the background. 当您的应用程序从前台过渡到后台时,系统会为您的应用程序的用户界面拍摄快照。 When your app returns to the foreground, it uses that image instead of a launch image whenever possible. 当您的应用返回到前景时,它会尽可能使用该图像而不是启动图像。 In cases where the user has killed your app or your app has not run for a long time, the system discards the snapshot and relies once again on your launch images. 如果用户杀死了您的应用程序或您的应用程序已长时间没有运行,则系统将丢弃快照并再次依赖您的启动映像。

New Xcode projects include image asset entries for your app's launch images. 新的Xcode项目包括应用程序启动图像的图像资产条目。 To add launch images, add the corresponding image files to the image assets of your project. 要添加启动图像,请将相应的图像文件添加到项目的图像资产中。 At build time, Xcode adds the appropriate keys to your app's Info.plist file and places the images in your app bundle. 在构建时,Xcode将适当的密钥添加到应用程序的Info.plist文件中,并将图像放置在应用程序包中。

For iPhone 6: 对于iPhone 6:

750 x 1334 (@2x) for portrait

1334 x 750 (@2x) for landscape

For iPhone 6 Plus: 对于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 https://developer.apple.com/library/ios/documentation/userexperience/conceptual/MobileHIG/LaunchImages.html#//apple_ref/doc/uid/TP40006556-CH22-SW1

Here are relevant bits of your Info.plist: 这是您的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