I have subclass of UIButton
:
@interface MyButton : UIButton
- (IBAction) buttonPressed:(id)sender;
@end
@implementation MyButton
- (void)awakeFromNib
{
NSLog(@"awake from nib");
}
- (IBAction) buttonPressed:(id)sender
{
NSLog(@"button pressed");
}
@end
I add a button in my parent xib, set it's class to MyButton, and connected it's action to First Responder
's method buttonPressed
.
When I start an application and load my parent xib with my button inside, than awakeFromNib
from MyButton class is called. But when I press the button, nothing happens. I was expecting that my method buttonPressed
from MyButton
class will be called.
I supposed, that my button's view is the first responder in responder chain, but apparently I do something wrong.
Could you please suggest something?