iOS WebView 类型在 iPhone 6 和 6+(Xamarin 应用程序)上错误地设置了 320 像素的视口大小

Both iOS WebView types incorrectly setting 320px viewport size on iPhone 6 and 6+ (Xamarin app)

我已经为此苦苦思索了几个小时。这是重现场景(Xamarin.iOS 8.10,iOS 8.2):

  1. 创建了一个(大部分)空的测试网页(没有样式表,正文上只有一个 width=100%),带有以下标签:<meta name="viewport" content="width=device-width, initial-scale=1.0">

  2. 页面加载在 UIWebViewWKWebView 中(首选)在专为纵向设计的瘦客户端应用程序中iPhone

  3. 模式
  4. 通过 iOS 模拟器调试,附加到父级 Safari 中的 WebView 实例 Mac

  5. 视口宽度在模拟bothiPhone6和6+时总是显示320px,使得网页显示缩放过大

  6. 通过移动 Safari 加载和调试的同一页面

  7. 视口宽度显示 414px (6+) 和 375px (6),符合预期

我已经在 WebView 上试验过 SizeToFit() 和 ScalesPagesToFit,在父级上试验过 AutoresizingMask ViewController,但它们似乎对报告的视口大小没有任何影响。

有谁知道为什么 WebView 的视口尺寸错误?这 我所到之处的规定方法。是 iOS 问题、Xamarin 问题,还是我遗漏或可能在代码中没有正确执行的问题?

事实证明,高分辨率 iPhone 所需的 启动图像 存在,但未正确包含在 iOS 项目中,导致应用加载于以前 iPhone 的分辨率较低。一旦 Default-667h@2x.pngDefault-736h@3x.png 文件被引用,应用程序就会按预期加载。留给 Apple 让他们的应用程序运行时分辨率取决于特定图像文件的存在与否!

为 iOS9+ 使用故事板。处理所有这些图像的麻烦也减少了。

https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/launch-screens/

NOTE: The information in this section is provided for historical reference only. Starting with iOS 9, Launch Screens should be created with Storyboards instead of including specific Image Asset Launch Screens for all of the different iOS Device types. Please see the Managing Launch Screens with Storyboards section below for details.