From 4dc6259a29d625e994e90eab1c0bba50c2c74612 Mon Sep 17 00:00:00 2001 From: empty Date: Sun, 8 Feb 2026 00:56:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20ResultView=20Live?= =?UTF-8?q?=20Photo=20=E9=A2=84=E8=A7=88=E5=AE=BD=E5=BA=A6=E9=93=BA?= =?UTF-8?q?=E6=BB=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PHLivePhotoView 无 intrinsic content size,SwiftUI 的 .aspectRatio() 对 UIViewRepresentable 无效。 改用 Color.clear + aspectRatio 撑出正确比例容器, 再用 .overlay 放入 Live Photo 预览。 同时移除 .frame(maxWidth: .infinity) 避免强制撑满。 Co-Authored-By: Claude Opus 4.6 (1M context) --- to-live-photo/to-live-photo/Views/ResultView.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/to-live-photo/to-live-photo/Views/ResultView.swift b/to-live-photo/to-live-photo/Views/ResultView.swift index 3e002ae..c317927 100644 --- a/to-live-photo/to-live-photo/Views/ResultView.swift +++ b/to-live-photo/to-live-photo/Views/ResultView.swift @@ -83,13 +83,16 @@ struct ResultView: View { let photoSize = livePhoto.size let ratio = photoSize.width / max(photoSize.height, 1) SoftCard(padding: DesignTokens.Spacing.md) { - LivePhotoPreviewView(livePhoto: livePhoto) + // PHLivePhotoView 无 intrinsic size,用 Color.clear 撑出正确比例 + Color.clear .aspectRatio(ratio, contentMode: .fit) .frame(maxHeight: 360) + .overlay { + LivePhotoPreviewView(livePhoto: livePhoto) + } .clipShape(RoundedRectangle(cornerRadius: DesignTokens.Radius.lg)) .accessibilityLabel(String(localized: "result.livePhotoPreview.accessibilityLabel")) } - .frame(maxWidth: .infinity) } Text(String(localized: "result.livePhotoPreview.hint"))