romaonthego / REFrostedViewController

iOS 7/8 style blurred view controller that appears on top of your view controller.
MIT License
2.96k stars 494 forks source link

Allow Zero as a valid value in width/height of minimumMenuViewSize #27

Closed bastibense closed 10 years ago

bastibense commented 10 years ago

I'd like to limit the width for menus with a direction of left/right, so that (especially on iPads) the menu doesn't end up taking the whole screen.

I figured that I'd have to set limitMenuViewSize to YES and set minimumMenuViewSize to the maximum size.

First, it's a bit confusing to call the property "minimumMenuViewSize" when it describes the "maximum" dimensions of the menu.

Secondly, and more importantly, it's awkward to handle rotation situations properly with the limits enabled. Let's say you set it to something like CGSizeMake(300, 1024), the menu will be filling the screen vertically and be 300 points wide. If you rotate the device now, the menu will remain at 1024 and screw up the user experience. The only way to work around this is to manually "fix" the width/height after a rotation - and that wouldn't feel very good.

What I'd like to see is to be able to assign a zero value to either the width or height, so that it limits the size of the menu in one dimension while keeping it properly sized in the other direction.

So for instance, a menu that has a maximum width of 300, but fills the height of the screen, could be defined as follows:

menu.maximumMenuSize = CGSizeMake(300, 0);

Respectively, having the default behaviour would be like this:

menu.maximumMenuSize = CGSizeMake(0, 0); // or CGSizeZero

By respecting the zero value in both directions, it would also allow you to get rid of the limitMenuViewSize flag at all, which would simplify the API.

romaonthego commented 10 years ago

I'll take a look. limitMenuViewSize - some devs requested it, so I won't be removing it.

thorst commented 10 years ago

This works. Can you document this behavior in the readme?