Quantcast
Channel: User trojanfoe - Stack Overflow
Viewing all articles
Browse latest Browse all 226

Answer by trojanfoe for How to create VStack within HStack with equal element widths?

$
0
0

I think you want scaledToFill() on both the VStack and the HStack:

HStack(alignment: .center, spacing: 0) {    ForEach(0...6, id: \.self) { _ in        VStack(alignment: .center) {            Text("T")        }        .frame(maxWidth: .infinity, maxHeight: .infinity)        .background(Color(UIColor.white.withAlphaComponent(0.1)))        .cornerRadius(5)        .padding(2)        .scaledToFill()    }}.frame(maxWidth: .infinity, idealHeight: 70).scaledToFill()

enter image description here

And where the .frame() is set does make a difference as pointed out by @timbre


Viewing all articles
Browse latest Browse all 226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>