iphone - UIButton in a custom UIView trouble -
i have simple (view-based) application. want on tapping on custom uiview button moved somewhere inside view (for example point 10,10).
- my custom uiview drawview (drawview.h , drawview.m).
- rotatorviewcontroller (h. , .m).
i add drawview uibutton, connect outlets drawview , uibutton. add uitapgesturerecognizer in rotatorviewcontroller , @selector(tap:). here 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 tap anywhere in drawview application crashes. here log console
2011-02-23 20:59:24.897 rotator[7345:207] -[drawview tap:]: unrecognized selector sent instance 0x4d0fa80 2011-02-23 20:59:24.900 rotator[7345:207] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[drawview tap:]: unrecognized selector sent instance 0x4d0fa80'
i need help
you said :
uitapgesturerecognizer in rotatorviewcontroller , @selector(tap:)
and wrote : uigesturerecognizer *tapgr = [[uitapgesturerecognizer alloc] initwithtarget:drawview action:@selector(tap:)];
it means actions performed in drawview delegate defined selector tap:
in rotatorviewcontroller
.
i think have replace target drawview
self
uigesturerecognizer *tapgr = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(tap:)];
Comments
Post a Comment