52inc / Pulley

A library to imitate the iOS 10 Maps UI.
https://cocoapods.org/pods/Pulley
MIT License
2.02k stars 265 forks source link

[QUESTION] How to resize the content of the drawer as it is opened and closed #415

Closed otusweb closed 3 years ago

otusweb commented 3 years ago

Describe the question I want to change the layout of the drawer as the drawer is pulled up. The changes mainly involve changing the height and/or position of some of the content.

Essentally when open the drawer should show

A
B
C

when collapse the drawer should show

B

And i'd like the resize to be animated as the user drags the drawer up and down.

Is that possible? I have not seen documentation on how to do this and the code sample does not seem to do this either.

otusweb commented 3 years ago

To answer my own question, i was able to set a constraint from the bottom of the drawer view to the bottom of the window. This causes the drawer content to shrink as needed via autolayout and animates as needed

In the drawer controller add: view.bottomAnchor.constraint(equalTo: view.window!.bottomAnchor).isActive = true