相关疑难解决方法(0)

How do you create a multi-line text inside a ScrollView in SwiftUI?

Since List doesn't look like its configurable to remove the row dividers at the moment, I'm using a ScrollView with a VStack inside it to create a vertical layout of text elements. Example below:

ScrollView {
    VStack {
        // ...
        Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer mattis ullamcorper tortor, nec finibus sapien imperdiet non. Duis tristique eros eget ex consectetur laoreet.")
            .lineLimit(0)
    }.frame(width: UIScreen.main.bounds.width)
}

Run Code Online (Sandbox Code Playgroud)

The resulting Text rendered is truncated single-line. Outside of a ScrollView it …

swift swiftui

20
推荐指数
2
解决办法
2160
查看次数

标签 统计

swift ×1

swiftui ×1