Reputation: 10748
As you can see from the image below the L
(Lorem) and the p
(previewing) are cutoff, any idea why some of the text inside the Text
gets cut off?
struct ContentView: View {
var body: some View {
ZStack {
Image("placeholder-image")
.resizable()
.scaledToFill()
.ignoresSafeArea()
VStack {
Text("Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups..")
.foregroundColor(Color.systemGray)
.cornerRadius(15)
Button("Tap Me") {
// some action
}.buttonStyle(.borderedProminent)
}
.padding()
.background(.thinMaterial)
.cornerRadius(15)
}
}
}
Upvotes: 0
Views: 482
Reputation: 258365
The cornerRadius
adds clipping, so remove it after text (anyway it is not needed there by logic of your code even if it would behave differently)
VStack {
Text("Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups..")
.foregroundColor(Color.systemGray)
//.cornerRadius(15) // << this !!
Upvotes: 2
Reputation: 1537
you can use as below for text:
.fixedSize(horizontal: false, vertical: true)
Upvotes: 2