I am trying to do some coding in Xcode and am having some problems with selectors. I have created a subclass of NSButton called modifiedNSButton. One of the constructors is
+ (id)CreateButtonViewUsingObject:(id)targetObject selector:(SEL)select caption:(NSString *)label;
However, the only way I have been able to get it to work is to pass the selector as @selector(bleep:) It works but I get the message
Incompatible pointer types sending 'NSString *' to parameter of type 'SEL'
I assume that this means that @selector(bleep:) is sent as an NSString instead of a SEL. However, it seems to work and I can't tell if I am doing something wrong. I will post my code to my Git for people to look at and then give a pointer to the location.
First, you really should follow the naming conventions in Objective C:
ModifiedNSButton, starting with a big letterThen, a "constructor" should also follow some conventions:
instancetype, notidinit...(likeinitUsingObject...)In your case, you should name it
+ (instancetype) modifiedNSButtonUsingObject:(id)targetObject selector:(SEL)select caption:(NSString*)labelAfter all this said, I don't see a problem with your code:
I don't see any "incompatible pointer type" warnings.