Let's say I have added more views in UIStackView which can be displayed, how I can make the UIStackView
scroll?
Ios – Is it possible for UIStackView to scroll
autolayoutiosuiscrollviewuistackview
Related Topic
- Ios – UIScrollView scroll to bottom programmatically
- Ios – Vertically align text to top within a UILabel
- Ios – How to make a UITextField move up when the keyboard is present – on starting to edit
- Ios – Passing data between view controllers
- Ios – How to animate constraint changes
- Ios – Using Auto Layout in UITableView for dynamic cell layouts & variable row heights
- Ios – UIScrollView Scrollable Content Size Ambiguity
- Ios – How to add leading padding to view added inside an UIStackView
Best Answer
In case anyone is looking for a solution without code, I created an example to do this completely in the storyboard, using Auto Layout.
You can get it from github.
Basically, to recreate the example (for vertical scrolling):
UIScrollView
, and set its constraints.UIStackView
to theUIScrollView
Leading
,Trailing
,Top
&Bottom
should be equal to the ones fromUIScrollView
Width
constraint between theUIStackView
andUIScrollView
.UIStackView
UIViews
to theUIStackView
Exchange
Width
forHeight
in step 4, and setAxis
=Horizontal
in step 5, to get a horizontal UIStackView.