小编Luk*_*Fan的帖子

SwiftUI:在我看来,文本被“...”截断

在我看来,我有很多文本和周围的边框,但有时会被切断并在末尾有“...”。我尝试过使用 .layout.layoutPriority().fixedSize(),奇怪的是,根据我使用的地点和频率,.layoutPriority()它不会在同一位置和每台设备上被切断。iPhone 8 iOS 13.3 模拟器中的屏幕截图。\n提前感谢您的帮助。

\n\n

这是我当前的代码

\n\n
import SwiftUI\nimport SafariServices\n\nstruct WhatIsStopView: View {\n\n    @State var show4 = false\n\n    var body: some View {\n        GeometryReader { geometry in\n            ScrollView(.vertical) {\n            VStack(alignment: .leading, spacing: 30) {\n                HStack(spacing: 15) {\n                    Text("whatIsAStop")\n                    Image(systemName: "camera")\n                }.font(.largeTitle)\n                VStack(alignment: .leading, spacing: 45) {\n                    VStack(alignment: .leading, spacing: 25) {\n                        Text("inPhotographyAStop").layoutPriority(2)\n\n                        Text("stopDoubling").fontWeight(.semibold).layoutPriority(2)\n\n                        Text("forExample").layoutPriority(2)\n\n                        VStack {\n                            Image("exposure-stops").resizable()\n                                        .aspectRatio(contentMode: .fit)\n                            Text("stopIsAMeasure").italic().layoutPriority(2)\n                        }\n\n                        Text("amountOfLightCaptured").layoutPriority(2)\n\n                    }\n\n                    VStack(alignment: .leading, spacing: 25) {\n                        Text("stopsAndShutterSpeed").font(.headline).layoutPriority(2)\n\n                        Text("shutterSpeedMeasures").layoutPriority(2)\n\n …
Run Code Online (Sandbox Code Playgroud)

layout swift swiftui

8
推荐指数
2
解决办法
7879
查看次数

标签 统计

layout ×1

swift ×1

swiftui ×1