Sto provando a determinare se un UILabel è stato toccato e in tal caso fare qualcosa. Dare ..Come posso determinare se un UILabel è stato toccato?
.
.
.
UILabel * site = [[UILabel alloc] initWithFrame:CGRectMake(0, 185, 320, 30)];
site.text = [retriever.plistDict valueForKey:@"url"];
site.textAlignment =UITextAlignmentCenter;
site.backgroundColor = [UIColor clearColor];
site.textColor = [UIColor whiteColor];
site.userInteractionEnabled = YES;
[theBgView addSubview:site];
[site release];
.
.
.
Quindi scrivo il callback.
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
retriever = [PListRetriever sharedInstance];
CGPoint pt = [[touches anyObject] locationInView: self];
NSURL *target = [[NSURL alloc] initWithString:[retriever.plistDict valueForKey:@"url"]];
[[UIApplication sharedApplication] openURL:target];
}
Il problema è adesso, non importa da dove tocchi in Visualizza l'Url è in fase di apertura. Come posso determinare se solo la mia etichetta è stata toccata?
Perché non si sostituisce semplicemente l'etichetta con un pulsante? – zonble