Answer the question
In order to leave comments, you need to log in
How to display images horizontally in one line SWIFTUI?
How to change the display of images in one line horizontally and not vertically as it is now (
Now the code is this:
//I1
HStack {
VStack(alignment: .leading) {
Image(champions.imagei1)
.resizable()
.scaledToFit()
.aspectRatio(1, contentMode: .fit)
}
.frame(width: 60, height: 60)
}
//I2
VStack(alignment: .leading) {
Image(champions.imagei2)
.resizable()
.scaledToFit()
.aspectRatio(1, contentMode: .fit)
}
.frame(width: 60, height: 60)
//I3
VStack(alignment: .leading) {
Image(champions.imagei3)
.resizable()
.scaledToFit()
.aspectRatio(1, contentMode: .fit)
}
.frame(width: 60, height: 60)
}.frame(minWidth: 0, idealWidth: 0, maxWidth: .infinity, minHeight: 0, idealHeight: 0, maxHeight: .infinity, alignment: .topLeading)
}
}
Answer the question
In order to leave comments, you need to log in
If I understand you correctly:
HStack {
Image(champions.imagei1)
.resizable()
.scaledToFit()
.aspectRatio(1, contentMode: .fit)
.frame(width: 60, height: 60)
Spacer()
Image(champions.imagei2)
.resizable()
.scaledToFit()
.aspectRatio(1, contentMode: .fit)
.frame(width: 60, height: 60)
Spacer()
Image(champions.imagei3)
.resizable()
.scaledToFit()
.aspectRatio(1, contentMode: .fit)
.frame(width: 60, height: 60)
}.padding()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question