Skip to content
This repository

rac_signalForControlEvents doesn't work on UILabels? Why? #407

Closed
zakdances opened this Issue · 3 comments

2 participants

zakdances Justin Spahr-Summers
zakdances

I'm a little confused as to what exactly I can assign a "UIControlEventTouchUpInside" action to. I get a "no visible interface" error for some elements, while others work. What are the limitations of signalForControlEvents? Shouldn't it be available for ALL UIViews and subclasses?

Secondary question: Is there a convenience macro for rac_signalForControlEvents or an easier syntax I should be using? (not that it isn't easy, I'm just wondering)

Justin Spahr-Summers
Owner

I'm a little confused as to what exactly I can assign a "UIControlEventTouchUpInside" action to. I get a "no visible interface" error for some elements, while others work. What are the limitations of signalForControlEvents? Shouldn't it be available for ALL UIViews and subclasses?

No, it will only work for UIControl subclasses (which UILabel is not). It's a RACified version of UIKit's -addTarget:action:forControlEvents: method, nothing more.

Secondary question: Is there a convenience macro for rac_signalForControlEvents or an easier syntax I should be using? (not that it isn't easy, I'm just wondering)

Nope, nothing like that exists. It would be pretty difficult to simplify beyond what's there already.

zakdances

Could RAC use UITapGestureRecognizer to attach touch-up events to various elements? This would be a great way to expand the functionality of rac_signalForControlEvents. If this is possible, I'd like to add this as a feature request. Currently I can't, for example, use rac_signalForControlEvents with a UIBarButtonItem because it doesn't inherit from UIButton.

zakdances

I just noticed there are several other issues open for this same thing. Maybe I should close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.