Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class MainViewController: AloeStackViewController {

private func setUpStackView() {
stackView.automaticallyHidesLastSeparator = true
edgesForExtendedLayout = []
navigationController?.navigationBar.isTranslucent = false
Comment on lines +38 to +39
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make view's top equals navigationBar's bottom

}

private func setUpRows() {
Expand All @@ -43,6 +45,7 @@ public class MainViewController: AloeStackViewController {
setUpHiddenRows()
setUpExpandingRowView()
setUpHorizontalRow()
// when hide PhotoRow stackview can also scroll
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment

setUpPhotoRow()
}

Expand Down
19 changes: 19 additions & 0 deletions Sources/AloeStackView/AloeStackViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ open class AloeStackViewController: UIViewController {
stackView.flashScrollIndicators()
}
}

open override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if stackViewCanAlwaysScroll {
if stackView.contentSize.height < view.frame.size.height {
var bottomPadding: CGFloat = 0
if #available(iOS 11.0, *) {
bottomPadding = UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 0
}
// contentSize height need to bigger than view height
stackView.contentSize = CGSize(width: 0, height: view.frame.size.height - bottomPadding + 0.5)
}
}
}
Comment on lines +43 to +56
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mark stackView always scroll


// MARK: Public

Expand All @@ -50,5 +64,10 @@ open class AloeStackViewController: UIViewController {
///
/// Default is `false`.
open var automaticallyFlashScrollIndicators = false

/// When true, stackView can always scroll
///
/// Default is `true`.
open var stackViewCanAlwaysScroll = true
Comment on lines +67 to +71
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool value for stackViewCanAlwaysScroll


}