ios - How to get CGPoint where a gesture is happening in Objective C -



ios - How to get CGPoint where a gesture is happening in Objective C -

i have added gesture recognizer because want x coordinate of touch (working on sound trimmer, need x coordinate handles of trimmer).

i have

uigesturerecognizer *recognizer; cgpoint leftcontrolpoint = [recognizer locationinview:self.view]; nslog(@"this touch %@", nsstringfromcgpoint(leftcontrolpoint));

however, nslog gives me {0,0}.

any thought what's going on?

thanks can do?

the proper way wire gesture recognizer this:

// in method, -viewdidload: uitapgesturerecognizer *tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(didtapview:)]; [self.view addgesturerecognizer:tap];

then:

- (void)didtapview:(uitapgesturerecognizer *)sender { cgpoint leftcontrolpoint = [sender locationinview:self.view]; nslog(@"this touch %@", nsstringfromcgpoint(leftcontrolpoint)); }

ios objective-c uigesturerecognizer

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -