splash 启动图改 scaleAspectFill 全屏覆盖(与 WebView 同款撤销黑边)

接上一 commit f4307cc(WebView 全屏铺满):splash 启动图也应保持一致策略,
否则启动瞬间(iOS 系统 LaunchScreen)和过渡期(SplashOverlay)仍会显示
左右大黑边,与 WebView 全屏的视觉不连续。

3 处 contentMode 从 scaleAspectFit 改为 scaleAspectFill:
- LaunchScreen.storyboard(iOS 启动瞬间)
- WebContainerViewController 内 SplashOverlay.imageView
- SubGameViewController 内 SplashOverlay.imageView

scaleAspectFill 行为:素材 1136×640(16:9)在现代 iPhone 横屏(19.5:9)
上高度撑满,宽度按比例放大→左右轻微裁切。启动图左右是空白底色,logo
+ 文字主体居中可见,裁切无影响。

等价 daoqi msext LaunchImage Asset Catalog 时代「启动图覆盖整屏」体感。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
joywayer
2026-06-23 07:26:15 +08:00
co-authored by Claude Opus 4.7
parent f4307ccc80
commit 1247c14351
3 changed files with 11 additions and 7 deletions
@@ -15,7 +15,7 @@
<rect key="frame" x="0.0" y="0.0" width="852" height="393"/> <rect key="frame" x="0.0" y="0.0" width="852" height="393"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" image="SplashImage" translatesAutoresizingMaskIntoConstraints="NO" id="ImgV-Sp-1ab"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" image="SplashImage" translatesAutoresizingMaskIntoConstraints="NO" id="ImgV-Sp-1ab">
<rect key="frame" x="0.0" y="0.0" width="852" height="393"/> <rect key="frame" x="0.0" y="0.0" width="852" height="393"/>
</imageView> </imageView>
</subviews> </subviews>
@@ -310,7 +310,9 @@ private final class SplashOverlay: UIView {
super.init(frame: .zero) super.init(frame: .zero)
backgroundColor = .black backgroundColor = .black
imageView.contentMode = .scaleAspectFit // scaleAspectFill:与 LaunchScreen / WebContainer splash 同款全屏覆盖策略
// (现代 iPhone 横屏 19.5:9 比 16:9 素材更宽,scaleAspectFit 会左右补大黑边)
imageView.contentMode = .scaleAspectFill
imageView.image = UIImage(named: "SplashImage") imageView.image = UIImage(named: "SplashImage")
imageView.clipsToBounds = true imageView.clipsToBounds = true
imageView.translatesAutoresizingMaskIntoConstraints = false imageView.translatesAutoresizingMaskIntoConstraints = false
@@ -630,11 +630,13 @@ private final class SplashOverlay: UIView {
super.init(frame: .zero) super.init(frame: .zero)
backgroundColor = .black backgroundColor = .black
// 与 LaunchScreen.storyboard 同款 contentMode:素材是 1136×640 横屏画面, // 与 LaunchScreen.storyboard 同款 contentMode = scaleAspectFill:
// 在更宽的现代横屏设备上用 scaleAspectFit 左右补黑边(黑底统一), // 素材是 1136×640(16:9)横屏画面,现代 iPhone 横屏约 19.5:9 比 16:9 更宽,
// 避免 scaleAspectFill 把 logo 上下裁切;同时确保 LaunchScreen → WebContainer // scaleAspectFill 高度撑满 + 宽度按比例放大→左右轻微裁切;启动图左右是空白底色,
// 视觉过渡时不出现裁切方式跳变。 // logo + 文字主体居中可见,裁切无影响。
imageView.contentMode = .scaleAspectFit // 等价 daoqi msext LaunchImage Asset Catalog 时代「启动图覆盖整屏」的体感,
// 避免 scaleAspectFit 在现代屏左右补大黑边。
imageView.contentMode = .scaleAspectFill
imageView.image = UIImage(named: "SplashImage") imageView.image = UIImage(named: "SplashImage")
imageView.clipsToBounds = true imageView.clipsToBounds = true
imageView.translatesAutoresizingMaskIntoConstraints = false imageView.translatesAutoresizingMaskIntoConstraints = false