-
Notifications
You must be signed in to change notification settings - Fork 170
make stackview always scroll #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,8 @@ public class MainViewController: AloeStackViewController { | |
|
|
||
| private func setUpStackView() { | ||
| stackView.automaticallyHidesLastSeparator = true | ||
| edgesForExtendedLayout = [] | ||
| navigationController?.navigationBar.isTranslucent = false | ||
| } | ||
|
|
||
| private func setUpRows() { | ||
|
|
@@ -43,6 +45,7 @@ public class MainViewController: AloeStackViewController { | |
| setUpHiddenRows() | ||
| setUpExpandingRowView() | ||
| setUpHorizontalRow() | ||
| // when hide PhotoRow stackview can also scroll | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment |
||
| setUpPhotoRow() | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mark stackView always scroll |
||
|
|
||
| // MARK: Public | ||
|
|
||
|
|
@@ -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
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bool value for stackViewCanAlwaysScroll |
||
|
|
||
| } | ||
There was a problem hiding this comment.
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