I have a simple (view-based) application. I want on tapping on custom UIView my button moved somewhere inside that view (for example to point 10,10).
- My custom UIView is DrawView (DrawView.h and DrawView.m).
- RotatorViewController (h. and .m).
I add to my DrawView an UIButton, connect with outlets my DrawView and UIButton. I add UITapGestureRecognizer in RotatorViewController and @selector(tap:). Here is code of UITapGestureRecognizer
- (void)viewDidLoad { [super viewDidLoad]; UIGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:drawView action:@selector(tap:)]; [drawView addGestureRecognizer:tapGR]; [tapGR release]; }
@selector(tap:)
- (void) tap:(UITapGestureRecognizer *)gesture { myButton.transform = CGAffineTransformMakeTranslation(10, 10); }
But when i tap anywhere in DrawView application crashes. Here is log from console
2011-02-23 20:59:24.897 Rotator[7345:207] -[DrawView tap:]: unrecognized selector sent to instance 0x4d0fa80 2011-02-23 20:59:24.900 Rotator[7345:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DrawView tap:]: unrecognized selector sent to instance 0x4d0fa80'
I need your help