Как организовать предметы панели инструментов Swiftui?IOS

Программируем под IOS
Anonymous
Как организовать предметы панели инструментов Swiftui?

Сообщение Anonymous »

У меня есть панель инструментов Swiftui с 4 кнопками, однако реализованный я код не является правильным, потому что кнопки заканчиваются в странных местах при изменении типа устройства в симуляторе. В разных устройствах iOS?
Спасибо!

Код: Выделить всё

 // This code spaces the buttons but they change positions depending on the iOS device

ToolbarItem {
HStack {
HStack {
ProfileUploadMediaButton()
}.padding([.trailing], 85)
HStack {
ProfileUsernameButton()
}.padding([.trailing], 84)
HStack {
ProfileLiveButton()
}.padding([.trailing], 6)
HStack {
AccountButton()
}.padding([.trailing], 12)
}
}
})

Код: Выделить всё

// I was thinking code like this but all buttons are bunched together on the right-side of  // the screen...

ToolbarItem {
HStack {
ProfileUploadMediaButton()
ProfileUsernameButton()
ProfileLiveButton()
AccountButton()
}
}


Подробнее здесь: https://stackoverflow.com/questions/660 ... lbar-items

Вернуться в «IOS»