I've subclassed a UILabel and added 2 properties that look like this:
@property (nonatomic, assign) SEL action;
@property (nonatomic, assign) id target;
I then implemented UIView's touches began method like this:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([target respondsToSelector:@selector(action)]) {
[target performSelector:@selector(action) onThread:[NSThread mainThread] withObject:nil waitUntilDone:NO];
}
}
within the class containing the subclassed UILabel, i set the target and action like this:
label.target = self;
labek.action = @selector(myMethod);
label.userInteractionEnabled = YES;
The class including the label does indeed have the method myMethod, and so it should respond to it. Any ideas why it might not?
thanks!