Stack Views's in iOS are a beautiful thing but I have realized there is no native way to create new rows in horizontal stack views. Let's say I dynamically added subviews in a horiztonal stack view and would want to create a new row once I reach an increment of 3 subviews respectively.
Would I be required to create a vertical stack view then programmatically populate it with individual horizontal stack views at an interval of 3 increments?
If so, would swift support dynamic variable creation of horzStackView1, horzStackView2, ... ?
I'm starting to believe there is an easier way to implement this but I can't think of anything as I'm new to Swift 2.
Yes, you would have to manually setup the the vertical and horizontal stack views yourself.
You may want to look into using UICollectionView
it supports having cells automatically wrap onto the next row if there is not enough space.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With