Skip to content

Commit 2ad28c3

Browse files
committed
fix #16: fix demo project
1 parent 1aec0c4 commit 2ad28c3

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

ScrollStackControllerDemo/Child View Controllers/NotesVC.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@ public class NotesVC: UIViewController, ScrollStackContainableController {
2424
}
2525

2626
public func scrollStackRowSizeForAxis(_ axis: NSLayoutConstraint.Axis, row: ScrollStackRow, in stackView: ScrollStack) -> ScrollStack.ControllerSize? {
27-
let size = CGSize(width: stackView.bounds.size.width, height: 9000)
28-
var best = self.view.systemLayoutSizeFitting(size, withHorizontalFittingPriority: .required, verticalFittingPriority: .defaultLow)
29-
best.height += 20 // just some offset for UITextView insets
30-
// NOTE:
31-
// it's important to set both the height constraint and bottom safe constraints to safe area for textview,
32-
// otherwise growing does not work.
33-
return .fixed(best.height)
27+
return .fitLayoutForAxis
3428
}
3529

3630

ScrollStackControllerDemo/Child View Controllers/TagsVC.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class TagsVC: UIViewController, ScrollStackContainableController {
5050

5151
public func scrollStackRowSizeForAxis(_ axis: NSLayoutConstraint.Axis, row: ScrollStackRow, in stackView: ScrollStack) -> ScrollStack.ControllerSize? {
5252
collectionView.layoutIfNeeded()
53-
return (isExpanded == false ? .fixed(130) : .fixed(130 + collectionView.contentSize.height + 20))
53+
return (isExpanded == false ? .fixed(150) : .fixed(150 + collectionView.contentSize.height + 20))
5454
}
5555

5656
public func reloadContentFromStackView(stackView: ScrollStack, row: ScrollStackRow, animated: Bool) {

ScrollStackControllerDemo/ViewController.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,13 @@ class ViewController: UIViewController, ScrollStackControllerDelegate {
6363
plainView.heightAnchor.constraint(equalToConstant: 300).isActive = true
6464
stackView.addRow(view: plainView)
6565
*/
66-
67-
stackView.addRows(controllers: [welcomeVC, notesVC/*, tagsVC, galleryVC, pricingVC*/], animated: false)
66+
stackView.addRows(controllers: [welcomeVC, notesVC, tagsVC, galleryVC, pricingVC], animated: false)
6867
}
6968

7069
@IBAction public func addNewRow() {
71-
stackView.addRows(controllers: [tagsVC, galleryVC, pricingVC], animated: false)
72-
73-
74-
// let galleryVC = GalleryVC.create()
75-
// stackView.scrollToTop()
76-
// stackView.addRow(controller: galleryVC, at: .top, animated: true)
70+
let galleryVC = GalleryVC.create()
71+
stackView.scrollToTop()
72+
stackView.addRow(controller: galleryVC, at: .top, animated: true)
7773
}
7874

7975
@IBAction public func hideOrShowRandomRow() {

0 commit comments

Comments
 (0)