Программируем под IOS
Anonymous
Сделайте vStack заполнить ширину экрана в Swiftui
Сообщение
Anonymous » 07 июл 2025, 19:27
Учитывая этот код: < /p>
Код: Выделить всё
import SwiftUI
struct ContentView: View {
var body: some View {
VStack(alignment: .leading) {
Text("Title")
.font(.title)
Text("Content")
.lineLimit(nil)
.font(.body)
Spacer()
}
.background(Color.red)
}
}
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif
Это приводит к этому интерфейсу:
vstect vstac Не нужна полная ширина?
Код: Выделить всё
VStack(alignment: .leading) {
HStack {
Spacer()
}
Text("Title")
.font(.title)
Text("Content")
.lineLimit(nil)
.font(.body)
Spacer()
}
, который дает желаемый дизайн:
>
Подробнее здесь:
https://stackoverflow.com/questions/564 ... in-swiftui
1751905631
Anonymous
Учитывая этот код: < /p> [code]import SwiftUI struct ContentView: View { var body: some View { VStack(alignment: .leading) { Text("Title") .font(.title) Text("Content") .lineLimit(nil) .font(.body) Spacer() } .background(Color.red) } } #if DEBUG struct ContentView_Previews : PreviewProvider { static var previews: some View { ContentView() } } #endif [/code] Это приводит к этому интерфейсу: vstect vstac Не нужна полная ширина?[code]VStack(alignment: .leading) { HStack { Spacer() } Text("Title") .font(.title) Text("Content") .lineLimit(nil) .font(.body) Spacer() } [/code] , который дает желаемый дизайн: > Подробнее здесь: [url]https://stackoverflow.com/questions/56487323/make-a-vstack-fill-the-width-of-the-screen-in-swiftui[/url]
Заставьте VStack заполнить ширину экрана в SwiftUI
Anonymous »
08 июл 2024, 16:11 » в форуме
IOS
Учитывая этот код:
import SwiftUI
struct ContentView: View {
var body: some View {
VStack(alignment: .leading) {
Text( Title )
.font(.title)
Text( Content )
.lineLimit(nil)
.font(.body)
Spacer()
}
.background(Color.red)
}
}
#if DEBUG
struct...
0 Ответы
11 Просмотры
Последнее сообщение Anonymous
08 июл 2024, 16:11
Заставьте VStack заполнить ширину экрана в SwiftUI
Anonymous »
09 июл 2024, 02:13 » в форуме
IOS
Учитывая этот код:
import SwiftUI
struct ContentView: View {
var body: some View {
VStack(alignment: .leading) {
Text( Title )
.font(.title)
Text( Content )
.lineLimit(nil)
.font(.body)
Spacer()
}
.background(Color.red)
}
}
#if DEBUG
struct...
0 Ответы
13 Просмотры
Последнее сообщение Anonymous
09 июл 2024, 02:13
0 Ответы
40 Просмотры
Последнее сообщение Anonymous
19 мар 2024, 14:05
0 Ответы
37 Просмотры
Последнее сообщение Anonymous
25 июн 2024, 11:50
Список центров SwiftUI внутри VStack
Anonymous »
04 янв 2024, 19:06 » в форуме
IOS
У меня есть следующий код:
var body: some View { VStack(выравнивание: .center, содержимое: { Разделитель() Список { Раздел { Текст( Строка 1 ) Текст( Строка 2 ) } заголовок: { Текст( Заголовок ) .font(.title3) .padding() } нижний колонтитул: {...
0 Ответы
26 Просмотры
Последнее сообщение Anonymous
04 янв 2024, 19:06