在我的观点中,我有很多文本并且周围有边框,但有时会被截断并在结尾处显示“...”。我已经尝试使用
谢谢您的帮助。以下是我的当前代码:
.layoutPriority()
和 .fixedSize()
,但奇怪的是,根据我使用 .layoutPriority()
的位置和频率不同,它在不同的设备上被截断的位置也不同。iPhone 8 iOS 13.3 模拟器中的屏幕截图。谢谢您的帮助。以下是我的当前代码:
import SwiftUI
import SafariServices
struct WhatIsStopView: View {
@State var show4 = false
var body: some View {
GeometryReader { geometry in
ScrollView(.vertical) {
VStack(alignment: .leading, spacing: 30) {
HStack(spacing: 15) {
Text("whatIsAStop")
Image(systemName: "camera")
}.font(.largeTitle)
VStack(alignment: .leading, spacing: 45) {
VStack(alignment: .leading, spacing: 25) {
Text("inPhotographyAStop").layoutPriority(2)
Text("stopDoubling").fontWeight(.semibold).layoutPriority(2)
Text("forExample").layoutPriority(2)
VStack {
Image("exposure-stops").resizable()
.aspectRatio(contentMode: .fit)
Text("stopIsAMeasure").italic().layoutPriority(2)
}
Text("amountOfLightCaptured").layoutPriority(2)
}
VStack(alignment: .leading, spacing: 25) {
Text("stopsAndShutterSpeed").font(.headline).layoutPriority(2)
Text("shutterSpeedMeasures").layoutPriority(2)
VStack {
Image("exposure-stops-shutter-speed").resizable()
.aspectRatio(contentMode: .fit)
Text("commonShutterSpeedStops").italic().layoutPriority(2)
}
Text("forExampleChanging").layoutPriority(2)
Text("mostCamerasAllow").layoutPriority(2)
}
VStack(alignment: .leading, spacing: 25) {
Text("stopsAndISOSpeed").font(.headline).layoutPriority(2)
Text("ISOSpeedDescribes").layoutPriority(2)
VStack {
Image("exposure-stops-iso-speed").resizable()
.aspectRatio(contentMode: .fit)
Text("commonISOSpeedStops").italic().layoutPriority(2)
}
Text("ISOIsMeasured").layoutPriority(2)
Text("forExampleSwitching").layoutPriority(2)
}
VStack(alignment: .leading, spacing: 25) {
Text("stopsAndAperture").font(.headline).layoutPriority(2)
Text("apertureIsMeasured").layoutPriority(2)
VStack {
Image("exposure-stops-aperture").resizable()
.aspectRatio(contentMode: .fit)
Text("commonApertureStops").italic().layoutPriority(2)
}
Text("becauseOfTheWay").layoutPriority(2)
Text("asWithShutterSpeed").layoutPriority(2)
}
VStack(alignment: .leading, spacing: 25) {
Text("stopsAreInterchangeable").font(.headline).layoutPriority(2)
Text("theGreatThing").layoutPriority(2)
Text("letsSay").layoutPriority(2)
Text("thisChangeOf").layoutPriority(2)
Text("youCouldOpen").layoutPriority(2)
Text("alternativelyYouCould").layoutPriority(2)
Text("asYouCanSee").layoutPriority(2)
}
VStack(alignment: .leading, spacing: 25) {
Text("conderationsWhenAdjustingExposure").font(.headline).layoutPriority(2)
Text("whenAdjustingTheThree").layoutPriority(2)
Text("shutterSpeedIf").layoutPriority(2)
Text("apertureA").layoutPriority(2)
Text("ISOSpeedThe").layoutPriority(2)
Text("asWithEverything").layoutPriority(2)
Text("exposureStopsAreA").layoutPriority(2)
}
Divider()
HStack {
Button(action: {
self.show4.toggle()
}) {
Text("linkToOriginalArticle").padding().foregroundColor(.white)
.background(LinearGradient(gradient: .init(colors: [.yellow,.purple]), startPoint: .leading, endPoint: .trailing))
.cornerRadius(20)
.sheet(isPresented: self.$show4) {
photography().edgesIgnoringSafeArea(.all)
}
}
Spacer()
Text("© Photography Mad")
}
}.padding()
.overlay(
RoundedRectangle(cornerRadius: 16)
.stroke((LinearGradient(gradient: .init(colors: [.purple,.blue]), startPoint: .leading, endPoint: .trailing)), lineWidth: 4)
)
Spacer()
}.padding()
VStack {
AdView().frame(width: 320, height: 50)
}.edgesIgnoringSafeArea([.top, .leading, .trailing])
}
}
.navigationBarTitle(Text("whatIsAStop"), displayMode: .inline)
}
}
struct WhatIsStopView_Previews: PreviewProvider {
static var previews: some View {
WhatIsStopView()
.environment(\.locale, .init(identifier: "fr"))
}
}
struct photography : UIViewControllerRepresentable {
func makeUIViewController(context: UIViewControllerRepresentableContext<photography>) -> SFSafariViewController {
let controller = SFSafariViewController(url: URL(string: "https://www.photographymad.com/pages/view/what-is-a-stop-of-exposure-in-photography")!)
return controller
}
func updateUIViewController(_ uiViewController: SFSafariViewController, context: UIViewControllerRepresentableContext<photography>) {
}
}
.lineLimit(nil)
吗? - E.Coms