iOS calling a method when user touches a certain area -
so have space between between keyboard , object. , want trigger method when user touches in area. how go doing this? i've tried using uiview uitapgesture cant seem working.
what "object" referencing?
if it's enabled user interaction need is...
- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { // } put in view controller. keyboard consume touches won't fire. if "object" has user interaction enabled consume touch also. fires when pressing area doesn't consume touches.
if doesn't consume touches then...
- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { // touch uitouch *touch = [touches anyobject]; // location of touch in main view of view controller cgpoint touchpoint = [touch locationinview:self.view]; // if touch inside object ignore if (cgrectcontainspoint(object.frame, touchpoint)) { return; } // something. }
Comments
Post a Comment