Passing class method as selector problem.

Posted by Anoide on Stack Overflow See other posts from Stack Overflow or by Anoide
Published on 2010-05-24T12:07:04Z Indexed on 2010/05/24 12:11 UTC
Read the original article Hit count: 143

Filed under:

Hi,

I want to build a selector from a class method.

I'm doing it this way:

NavigationTreeActionHandler* handler=[NavigationTreeActionHandler self];
NavigationTreeNode* bombsNode=new NavigationTreeNode("Bombs","bigbomb.tif"
     ,handler,@selector(BigBombButtonPressed:));

I need to pass to NavigationTreeNode the target and the selector to the target method. I try to get the target using the self property of the class object (Don't know if htis is the correct way to do it). Then I get the selector for the class method I want to call on the class.

Everything compiles ok but it fails when I use:

[[handler class] instanceMethodSignatureForSelector:selector];

I get a nil and don't really know why... could anybody help please?

Thanks in advance, Olson.

© Stack Overflow or respective owner

Related posts about objective-c