Files
e-party-iOS/yana/Utils/ScreenAdapterExample.swift
edwinQQQ 567b1f3fd9 feat: 全面替换硬编码文本并修复编译错误
- 替换多个视图中的硬编码文本为本地化字符串,增强多语言支持。
- 修复编译错误,包括删除重复文件和修复作用域问题。
- 更新本地化文件,新增40+个本地化键值对,确保文本正确显示。
- 添加语言切换测试区域,验证文本实时更新功能。
2025-07-29 15:31:19 +08:00

54 lines
1.6 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import SwiftUI
/// ScreenAdapter 使
/// SwiftUI 使
struct ScreenAdapterExample: View {
var body: some View {
GeometryReader { geometry in
VStack(spacing: 20) {
Text(LocalizedString("screen_adapter.method1", comment: ""))
.font(.headline)
.padding()
.background(Color.blue.opacity(0.1))
.cornerRadius(8)
Text(LocalizedString("screen_adapter.method2", comment: ""))
.font(.headline)
.padding()
.background(Color.green.opacity(0.1))
.cornerRadius(8)
Text(LocalizedString("screen_adapter.method3", comment: ""))
.font(.headline)
.padding()
.background(Color.orange.opacity(0.1))
.cornerRadius(8)
}
.padding()
}
}
}
// MARK: - 使
/*
使
1. View Extension ()
.adaptedFont(16)
.adaptedHeight(20)
.adaptedWidth(100)
2. ()
.font(.system(size: ScreenAdapter.fontSize(16, for: geometry.size.width)))
.padding(.top, ScreenAdapter.height(20, for: geometry.size.height))
3. ()
let ratio = ScreenAdapter.heightRatio(for: geometry.size.height)
.padding(.top, 20 * ratio)
*/
#Preview {
ScreenAdapterExample()
}