infinitered / ProMotion-menu

RubyMotion gem allowing you to easily setup a facebook or Path style hidden slide menu easily with the ProMotion gem.
74 stars 29 forks source link

Changing the drawerVisualState using MMDrawerController #48

Closed Brian-Egan closed 9 years ago

Brian-Egan commented 9 years ago

Hi, this gem has made my life so much simpler. But I'm trying to get a little fancy and take advantage of MMDrawerController's animations ('parallax', 'slideAndScale','slide', and 'swingingDoor'). I'm following the 'Encapsulated Approach' and after creating @menu as an instance of MenuDrawer, attempting to call either @menu.setDrawerVisualState(MMDrawerVisualState.slideAndScaleVisualStateBlock) or @menu.drawerVisualState = MMDrawerVisualState.slideAndScaleVisualStateBlock.

This works perfectly when I call it from the console, however calling it from anyplace in my code throws the following error:

Objective-C stub for message `drawerVisualState' type `@?@:' not precompiled. Make sure you properly link with the framework or library that defines this message.

Any advice? Or is this something that's just not supported?

macfanatic commented 9 years ago

I haven't used this feature in any projects myself, but looked through the docs a bit and don't see the method you reference above and want to rule out that simple typo as the problem if that's all it is.

Can you confirm that you get the error message when you use the following? You examples are leaving off Block at the end of the method names.

@menu.drawerVisualStateBlock = MMDrawerVisualState.slideAndScaleVisualStateBlock
Brian-Egan commented 9 years ago

Ha, I don't know if I was just exhausted last night or what but that works perfectly! Thanks @macfanatic !

Those other two methods do show up when I pull up the methods in Ruby, I think that's what threw me off and being a bit blearly-eyed I just didn't notice the addition of Block in the docs. Thanks again!

@menu.methods.grep(/Visual/)
=> [:"updateDrawerVisualStateForDrawerSide:percentVisible:", :"resetDrawerVisualStateForDrawerSide:", :"setDrawerVisualState:", :drawerVisualState, :"setDrawerVisualStateBlock:"]
macfanatic commented 9 years ago

Been there more times than I'd like to admit myself, glad it was an easy fix!