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
We recently added the LayoutSizable protocol so that both views and view controllers can report their layout size to the bottom sheet controller and the sheet can be the correct height when presented.
But what happens if that view (or view controller) changes size? e.g. new data arrives and the table view now has 6 rows instead of 4? How can the table view let the sheet know that it should recalculate its ideal size?
A Suggestion
Add an overridable method invalidatesLayoutSize() to UIViewController. A table view controller could call this when its data changes.
The default implementation of this method on UIViewController is to call the same method on its parent, thus moving it up the view controller chain until it finds a suitable responder (or reaches the top-level view controller).
BottomSheetController override this method and instead of calling to its parent, it just calls updateChildView() which will then adjust the idealContentHeightAnchor by re-evaluating layoutSize on the child.
The text was updated successfully, but these errors were encountered:
The Challenge
We recently added the
LayoutSizable
protocol so that both views and view controllers can report their layout size to the bottom sheet controller and the sheet can be the correct height when presented.But what happens if that view (or view controller) changes size? e.g. new data arrives and the table view now has 6 rows instead of 4? How can the table view let the sheet know that it should recalculate its ideal size?
A Suggestion
invalidatesLayoutSize()
toUIViewController
. A table view controller could call this when its data changes.UIViewController
is to call the same method on itsparent
, thus moving it up the view controller chain until it finds a suitable responder (or reaches the top-level view controller).BottomSheetController
override this method and instead of calling to its parent, it just callsupdateChildView()
which will then adjust theidealContentHeightAnchor
by re-evaluatinglayoutSize
on the child.The text was updated successfully, but these errors were encountered: