Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

luckysmiles

macrumors newbie
Original poster
Nov 30, 2010
1
0
Hi all,

Do u anyone know that how to set same UITapGestureRecognizer to two labels.....
Actually i did taprecognizer definition in viewdidload method and assign it to two labels....
but that single tap works only for label2..why it was happening??Pls help me guys...
pls see the following code..

///////////////////////////////
-(void )viewDidLoad{
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc]
initWithTarget:self action:mad:selector(handleSingleTap:)];

[singleTap setNumberOfTapsRequired:1];
[label1 addGestureRecognizer:singleTap];
[label2 addGestureRecognizer:singleTap];
[singleTap release];
}
- (void)handleSingleTap:(UITapGestureRecognizer *)recognizer {
NSLog(@"single tap");
}
}

Thanks in advance...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.