iPhone:How to find the control interaction under Touch?

Posted by user187532 on Stack Overflow See other posts from Stack Overflow or by user187532
Published on 2010-03-29T07:15:41Z Indexed on 2010/03/29 7:23 UTC
Read the original article Hit count: 270

Filed under:

Hello friends,

I have a UILabel control in a view. I want to detect touch event occurred when this label touched. I added the following code, which should work whenever touch happens on the view.

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

{

// This should be called only when the label is touched, not all the time..
[ [UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.mywebsite.com"] ];

}

Whenever that particular label is touched my code should do the process further, not when the touch is happening anywhere in the view. How do i find out the particular label (or) any control is touched under touchesEnded function ?

Could someone guide me on this?

Thank you.

© Stack Overflow or respective owner

Related posts about iphone