您可以使用UITextview并添加点按手势,而不是使用UILabel.这是一个例子,通过你可以实现相同的结果.
/* Set Tap gesture on Text view */ UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapResponse:)]; tapGesture.numberOfTapsRequired = 1; [yourTextView addGestureRecognizer:tapGesture]; - (void) tapResponse:(UITapGestureRecognizer *)recognizer { UITextView *textView = (UITextView *)recognizer.view; CGPoint location = [recognizer locationInView:textView]; CGPoint position = CGPointMake(location.x, location.y); //get location in text from textposition at point UITextPosition *tapPosition = [textView closestPositionToPoint:position]; //fetch the word at this position (or nil, if not available) UITextRange *textRange = [textView.tokenizer rangeEnclosingPosition:tapPosition withGranularity:UITextGranularityWord inDirection:UITextLayoutDirectionRight]; NSString *tappedWord = [textView textInRange:textRange]; NSLog(@"tapped word : %@", tappedWord); }