Appuyez sur le Geste, sur une partie de UILabel

Je pourrais ajouter avec succès appuyez sur les gestes à une partie de UITextView avec le code suivant:

UITextPosition *pos = textView.endOfDocument;//textView ~ UITextView

for (int i=0;i<words*2-1;i++){//*2 since UITextGranularityWord considers a whitespace to be a word

    UITextPosition *pos2 = [textView.tokenizer positionFromPosition:pos toBoundary:UITextGranularityWord inDirection:UITextLayoutDirectionLeft];
    UITextRange *range = [textView textRangeFromPosition:pos toPosition:pos2];
    CGRect resultFrame = [textView firstRectForRange:(UITextRange *)range ];

    UIView* tapViewOnText = [[UIView alloc] initWithFrame:resultFrame];
    [tapViewOnText addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(targetRoutine)]];
    tapViewOnText.tag = 125;
    [textView addSubview:tapViewOnText];

    pos=pos2;
}

Je tiens à imiter le même comportement dans un UILabel. La question est, UITextInputTokenizer (utilisés pour marquer les mots individuels) est déclarée dans UITextInput.h, et seulement UITextView & UITextFieldconforme à UITextInput.h; UILabel ne le fait pas.
Est-il une solution pour cela ??

salut l'ami, avez-vous vérifié l'interaction de l'utilisateur du comportement de UILabel, parce que par défaut userinteraction est PAS de UIlabel, vous devrez les régler OUI.Permettez-moi sais c'est que ça fonctionne ou pas.!!!
L'Action sur l'ensemble d'un UILabel n'est pas un problème, c'est une partie de UILabel.
Veuillez consulter stackoverflow.com/questions/8811909/...

OriginalL'auteur n00bProgrammer | 2013-07-24