You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to make a simple menu system with lists//labels and realized there were no actual way of making it work (or at least, that I know of) so I started thinking, can't we make anything anything tap-able like UI::Button? Now I haven't tried this, but looking at the button.rb file, I found this:
module UI
class Button < UI::Control
include Eventable
...
Does it mean all we have to do to make labels tap-able is add the first two methods and include UI::Control::Eventable in the Label Class? I tried to modify the label.rb files but they were read-only. Needless to say I haven't actually actioned anything yet.
If there's an obvious solution that already exists, I apologise in advance, I'm new to ruby, rubymotion and the mac ecosystem. lol. Figured I'd suggest it, just as food for thought. Let me know what you guys think.
The text was updated successfully, but these errors were encountered:
You would override on(event) to add a gesture recognizer on the label. At least this is how you could achieve this on iOS.
# in label classincludeEventabledefon(event, &block)caseeventwhen:taptap=UITapGestureRecognizer.alloc.initWithTarget(self,action: "on_tap")proxy.addGestureRecognizer(tap)elseraise"Expected event to be in : `:tap`"endsuperenddefon_tapself.trigger(:tap)end
Hi All,
I was trying to make a simple menu system with lists//labels and realized there were no actual way of making it work (or at least, that I know of) so I started thinking, can't we make anything anything tap-able like UI::Button? Now I haven't tried this, but looking at the button.rb file, I found this:
def initialize(view)
@view = view
end
def onClick(button)
@view.trigger :tap
end
end
module UI
class Button < UI::Control
include Eventable
...
Does it mean all we have to do to make labels tap-able is add the first two methods and include UI::Control::Eventable in the Label Class? I tried to modify the label.rb files but they were read-only. Needless to say I haven't actually actioned anything yet.
If there's an obvious solution that already exists, I apologise in advance, I'm new to ruby, rubymotion and the mac ecosystem. lol. Figured I'd suggest it, just as food for thought. Let me know what you guys think.
The text was updated successfully, but these errors were encountered: