romaonthego / REFrostedViewController

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

Pop Menu View Back To Fully Closed Or Fully Open If Halfway Isn't Reached #146

Open cnowak7 opened 8 years ago

cnowak7 commented 8 years ago

I'm quite new to iOS programming. I need to have the menu view pop to fully closed or fully open if the menu view doesn't reach halfway in the process of being opened or closed. For example, if I am slowly opening the menu view by sliding from the left side of my screen (I customized it like that :D), the menu should fully close if the menu view was less than half of the way to being open when I lifted my finger.

When the menu is open and I'm in the process of closing it, the menu should pop back to fully open if it was less than half of the way to being closed when I lifted my finger. The opposite applies for both cases in which the menu should automatically pop open or closed if the menu was MORE than halfway after I lifted my finger.

I think I'll have to do this with the menu's width in the math, but how can I get that? And where in the pan gesture recognized code would I put it? There's a lot of math being done in there and it really confuses me, so any help or advice would be greatly appreciated.

Thanks.