You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create complex scrollable layout using UIViewController and simplify your code!
13
+
Create complex scrollable layout using UIViewControllers or plain UIViews and simplify your code!
14
14
15
15
ScrollStackController was created and maintaned by [Daniele Margutti](https://twitter.com/danielemargutti) › [Web Site](https://www.danielemargutti.com)
16
16
@@ -19,7 +19,8 @@ ScrollStackController is a class you can use to create complex layouts using scr
19
19
20
20
You can think of it as `UITableView` but with several differences:
21
21
22
-
-**Each row is a different `UIViewController` you can manage independently**: no more massive controllers, a much cleaner and maintainable architecture.
22
+
-**Each row can a different `UIViewController` you can manage independently**: no more massive controllers, a much cleaner and maintainable architecture.
23
+
-**You can still use plain `UIView` instances if need a lightweight solution**: this is especially useful when you are using ScrollStackController as layout-helper or your view don't have a complex logic and you can still use the main controller.
23
24
-**Powered by AutoLayout since the beginning**; it uses a combination of `UIScrollView + UIStackView` to offer an animation friendly controller ideal for fixed and dynamic row sizing.
24
25
-**You don't need to struggle yourself with view recycling**: suppose you have a layout composed by several different screens. There is no need of view recycling but it cause a more difficult managment of the layout. With a simpler and safer APIs set `ScrollStackView` is the ideal way to implement such layouts.
25
26
@@ -30,6 +31,7 @@ You can think of it as `UITableView` but with several differences:
@@ -500,6 +503,27 @@ Moreover you can set these values directly on `ScrollStack` controller in order
500
503
501
504
[↑ Back To Top](#index)
502
505
506
+
<aname="lightweightplainuiview"/>
507
+
508
+
### Using plain UIViews instead of view controllers
509
+
510
+
Since version 1.3.x ScrollStack can also be used to layout plain `UIView` instances which not belong to a parent view controllers.
511
+
This is especially useful when you don't have a complex logic in your views and you want to use ScrollStack to make custom layout and keep your code lightweight.
512
+
513
+
Using plain views is pretty easy; each row method supports both `UIView` or `UIViewController` as parameter.
514
+
515
+
Since you are working with plain `UIView` instances in order to size it correctly you must set its `heightAnchor` or `widthAncor` (depending of your stack orientation) before adding it to the stack.
516
+
As for controllers, `ScrollStack` keeps a strong reference to the managed view which is added as `contentView` of the parent `ScrollStackRow` instance as it happens for `UIViewController`'s `.view` property.
0 commit comments