gpt4 book ai didi

ios - 文本标签未根据 ScrollView SwiftUI 中的字符串扩展

转载 作者:行者123 更新时间:2023-11-28 13:28:54 25 4
gpt4 key购买 nike

enter image description here我只是在 ScrollView 中添加了 TextLabel,但它仅显示在 1 行中。没有 ScrollView ,它在标签的全高下工作正常

 struct UserDetailView: View {

var userObj:User?

var body: some View {
ScrollView {
VStack {

Text("Hi here is Erick jackson. We need to help you. We will help you. Anything new to learn from you. I am here for that reason.")
.background(Color.orange)
.multilineTextAlignment(.center)
.lineLimit(5)
}
}
.padding(.horizontal,30)
}
}

最佳答案

Text("Hi here is Erick Jackson....") 之后尝试 .fixedSize 修饰符:

...

Text("Hi here is Erick jackson. We need to help you. We will help you. Anything new to learn from you. I am here for that reason.")
.fixedSize(horizontal: false, vertical: true)

.background(Color.orange)

...

关于ios - 文本标签未根据 ScrollView SwiftUI 中的字符串扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57820928/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com