My ViewController.m creates an instance of a myUIView.
In myUIView a UIButton is created.
All seems good, except to capture the button presses I use addTarget, at the ViewController level.
Pressing the button causes a crash, saying: “unrecognized selector sent to instance 0x6c254e0…”
Is this addTarget code wrong? Would appreciate anyone’s assistance.
- (void)viewDidLoad{
<UIVIew implementation etc...>
[myUIView.myButton addTarget:self action:@selector(myButtonIsPressed:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)myButtonIsPressed{
NSLog(@"Pressed!");
}
Thanks.
Simply remove : after myButtonIsPressed in the line :