I'm using respondsToSelector:
and most of the time it works fine. But there is one case in which I get wrong result:
UIButton* button = [[UIButton alloc] init];
if([button respondsToSelector:NSSelectorFromString(@"setTitle:")]) // returns YES
{
// try to call "setTitle:"
}
respondsToSelector:
returns YES but there is no setTitle:
selector in UIButton class. There is setTitle:forState:
selector but this is definitely not the same.
So why does respondsToSelector:
return YES?