Ios UITextView检测字点击式链接

Ios UITextView检测字点击式链接,ios,hyperlink,range,uitextview,tap,Ios,Hyperlink,Range,Uitextview,Tap,假设我有一个文本视图,其中包含属性文本,如“11 22 333”。我希望用户能够点击11并执行操作,点击22并执行操作,依此类推。我不能只把按钮放在顶部,因为标签总是在变化。我怎样才能检测到这个 <UITextViewDelegate> textViewForCountDown.delegate = self; //// [hour setText:[NSString stringWithFormat:@"%ld", (long)[components day] * 24 +

假设我有一个文本视图,其中包含属性文本,如“11 22 333”。我希望用户能够点击11并执行操作,点击22并执行操作,依此类推。我不能只把按钮放在顶部,因为标签总是在变化。我怎样才能检测到这个

<UITextViewDelegate>

textViewForCountDown.delegate = self;

////

[hour setText:[NSString stringWithFormat:@"%ld", (long)[components day] * 24 + (long)[components hour]]];
[minute setText:[NSString stringWithFormat:@"%ld", (long)[components minute]]];
[second setText:[NSString stringWithFormat:@"%ld", (long)[components second]]];
[second2 setText:[NSString stringWithFormat:@"%ld", (long)[components second] - 1]];

    UIFont *mediumFont = [UIFont fontWithName:@"FuturaPT-Heavy" size:65];
    UIColor *mediumColor = [self colorWithHexString:@"ffbc00"];
    NSDictionary *arialDict = [NSDictionary dictionaryWithObjects:@[mediumFont, mediumColor] forKeys:@[NSFontAttributeName,NSForegroundColorAttributeName]];
    NSMutableAttributedString *aAttrString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@", second.text] attributes: arialDict];

    UIColor *thinColor = [self colorWithHexString:@"353535"];
    NSDictionary *verdanaDict = [NSDictionary dictionaryWithObjects:@[mediumFont, thinColor] forKeys:@[NSFontAttributeName,NSForegroundColorAttributeName]];
    NSMutableAttributedString *vAttrString = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@", minute.text] attributes:verdanaDict];

    UIColor *thinColor2 = [self colorWithHexString:@"929292"];
    NSDictionary *verdanaDict2 = [NSDictionary dictionaryWithObjects:@[mediumFont, thinColor2] forKeys:@[NSFontAttributeName,NSForegroundColorAttributeName]];
    NSMutableAttributedString *vAttrString2 = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@", hour.text] attributes:verdanaDict2];

    [aAttrString appendAttributedString:vAttrString];
    [aAttrString appendAttributedString:vAttrString2];
    textViewForCountDown.attributedText = aAttrString;

    //Currently the textViewForCountDown displays 29 9 381.

    //The user should be able to click on the 29 and have an action occur (action 1)
    //The user should be able to click on the 9 and have an action occur (action 2)
    //The user should be able to click on the 381 and have an action occur (action 3)

textViewForCountDown.delegate=self;
////
[hour setText:[NSString stringWithFormat:@“%ld”,(长)[组件日]*24+(长)[组件小时]];
[minute setText:[NSString stringWithFormat:@“%ld”,长)[components minute]];
[second setText:[NSString stringWithFormat:@“%ld”,长)[组件秒]];
[second2 setText:[NSString stringWithFormat:@“%ld”,长)[组件秒]-1];
UIFont*mediumFont=[UIFont fontWithName:@“FuturaPT Heavy”大小:65];
UIColor*mediumColor=[self colorWithHexString:@“ffbc00”];
NSDictionary*ArialDictionary=[NSDictionary Dictionary WithObjects:@[mediumFont,mediumColor]forKeys:@[NSFontAttributeName,NSForegroundColorAttributeName]];
NSMutableAttributedString*aAttrString=[[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@“%@”,second.text]属性:arialDict];
UIColor*thinColor=[自身颜色与十六进制字符串:@“3535”];
NSDictionary*verdanaDict=[NSDictionary Dictionary WithObjects:@[mediumFont,thinColor]forKeys:@[NSFontAttributeName,NSForegroundColorAttributeName]];
NSMutableAttributedString*vAttrString=[[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@“%@”,minute.text]属性:verdanaDict];
UIColor*thinColor2=[self colorWithHexString:@“929292”];
NSDictionary*verdanaDict2=[NSDictionary Dictionary WithObjects:@[mediumFont,thinColor2]forKeys:@[NSFontAttributeName,NSForegroundColorAttributeName];
NSMutableAttributedString*vAttrString2=[[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@“%@”,hour.text]属性:verdanaDict2];
[aAttrString AppendAttributeString:vAttrString];
[aAttrString AppendAttributeString:vAttrString2];
textViewForCountDown.attributedText=aAttrString;
//当前,文本ViewForCountdown显示29 9 381。
//用户应该能够单击29并执行操作(操作1)
//用户应该能够单击9并执行操作(操作2)
//用户应该能够单击381并执行操作(操作3)