From 1247c1435108d634a2a9bb0564ba4d3e00febbab Mon Sep 17 00:00:00 2001 From: joywayer Date: Tue, 23 Jun 2026 07:26:15 +0800 Subject: [PATCH] =?UTF-8?q?splash=20=E5=90=AF=E5=8A=A8=E5=9B=BE=E6=94=B9?= =?UTF-8?q?=20scaleAspectFill=20=E5=85=A8=E5=B1=8F=E8=A6=86=E7=9B=96?= =?UTF-8?q?=EF=BC=88=E4=B8=8E=20WebView=20=E5=90=8C=E6=AC=BE=E6=92=A4?= =?UTF-8?q?=E9=94=80=E9=BB=91=E8=BE=B9=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 接上一 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 --- ylgamehall/Base.lproj/LaunchScreen.storyboard | 2 +- .../Source/WebView/SubGameViewController.swift | 4 +++- .../Source/WebView/WebContainerViewController.swift | 12 +++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ylgamehall/Base.lproj/LaunchScreen.storyboard b/ylgamehall/Base.lproj/LaunchScreen.storyboard index 206ab88..520e9d8 100644 --- a/ylgamehall/Base.lproj/LaunchScreen.storyboard +++ b/ylgamehall/Base.lproj/LaunchScreen.storyboard @@ -15,7 +15,7 @@ - + diff --git a/ylgamehall/Source/WebView/SubGameViewController.swift b/ylgamehall/Source/WebView/SubGameViewController.swift index 77f5feb..b5608ee 100644 --- a/ylgamehall/Source/WebView/SubGameViewController.swift +++ b/ylgamehall/Source/WebView/SubGameViewController.swift @@ -310,7 +310,9 @@ private final class SplashOverlay: UIView { super.init(frame: .zero) 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.clipsToBounds = true imageView.translatesAutoresizingMaskIntoConstraints = false diff --git a/ylgamehall/Source/WebView/WebContainerViewController.swift b/ylgamehall/Source/WebView/WebContainerViewController.swift index c205790..2690436 100644 --- a/ylgamehall/Source/WebView/WebContainerViewController.swift +++ b/ylgamehall/Source/WebView/WebContainerViewController.swift @@ -630,11 +630,13 @@ private final class SplashOverlay: UIView { super.init(frame: .zero) backgroundColor = .black - // 与 LaunchScreen.storyboard 同款 contentMode:素材是 1136×640 横屏画面, - // 在更宽的现代横屏设备上用 scaleAspectFit 左右补黑边(黑底统一), - // 避免 scaleAspectFill 把 logo 上下裁切;同时确保 LaunchScreen → WebContainer - // 视觉过渡时不出现裁切方式跳变。 - imageView.contentMode = .scaleAspectFit + // 与 LaunchScreen.storyboard 同款 contentMode = scaleAspectFill: + // 素材是 1136×640(16:9)横屏画面,现代 iPhone 横屏约 19.5:9 比 16:9 更宽, + // scaleAspectFill 高度撑满 + 宽度按比例放大→左右轻微裁切;启动图左右是空白底色, + // logo + 文字主体居中可见,裁切无影响。 + // 等价 daoqi msext LaunchImage Asset Catalog 时代「启动图覆盖整屏」的体感, + // 避免 scaleAspectFit 在现代屏左右补大黑边。 + imageView.contentMode = .scaleAspectFill imageView.image = UIImage(named: "SplashImage") imageView.clipsToBounds = true imageView.translatesAutoresizingMaskIntoConstraints = false