mkko / DrawerView

A drop-in view, to be used as a drawer anywhere in your app
MIT License
374 stars 57 forks source link

Can you specify .open height? #8

Closed ghost closed 3 years ago

ghost commented 5 years ago

This is awesome. I don't have a full screen view. Can we specify a hight for .open state as well, if so how?

mkko commented 5 years ago

Thanks! The size of the .open state is defined by topMargin property. So, there's no way of setting the open size to a specific height. You can only tell how much smaller the drawer is to its superview.

However, I'm facing the same issue where some content doesn't span full screen and would look better without the extra space at the bottom. I was thinking of adding a way to control the maximum height of the drawer. Would that help your use case?

vincentthe0ne commented 5 years ago

@mkko actually that would help in a case where I am using the Drawer. I have a Use Case where only the content of the Drawer should be visible and the only action should be to close the drawer (no pulling up or down). My current implementation of your drawer adds the contentView from a xib and I set the drawer.partiallyOpenHeight = contentView.intrinsicContentSize.height and set drawer.snapPositions = [.partiallyOpen]. Unfortunately the height of the Drawer still is higher than the content (e.g. 688 on a plus device) which leads to broken constraints of my contentView and the last element in that view is stretched until the end of the drawer. I tried to set drawer.frame.size.height = contentView.intrinsicContentSize.height but that did not help.

mkko commented 4 years ago

@vincentthe0ne Apologies for the big delay, but if your issue is still valid, could you check https://github.com/mkko/DrawerView/pull/21? Besides the modal drawer presentation, there's an option to specify the height of the drawer. I'll merge it once I'm confident that it serves different use cases well.

mkko commented 4 years ago

Oh, and this is also to address your issue, @ghubaddole.

mkko commented 3 years ago

I'm planning on adding a more or less dynamic behavior into the drawer so that optionally it's not at full height. The API is still unclear to me but I'l be working on this as soon as I have time. I'll let you know when I have a PR for this ready.