Objective c 无法将自定义链接添加到OHAttributeLabel

Objective c 无法将自定义链接添加到OHAttributeLabel,objective-c,xcode,hyperlink,uilabel,Objective C,Xcode,Hyperlink,Uilabel,我正在使用OHAttributeLabel向标签文本添加自定义链接。我正在使用的代码粘贴在下面。它曾用于旧版本的OHSTABLE 2010,但随着新版本最近的更新,“我的标签”中的文本不再可以作为链接单击 有人能告诉我这里缺少什么吗 // Set Question Label Question *question = self._answerForCell.question; NSString *questionText = [NSString stringWithFormat:@"Q: %@"

我正在使用OHAttributeLabel向标签文本添加自定义链接。我正在使用的代码粘贴在下面。它曾用于旧版本的OHSTABLE 2010,但随着新版本最近的更新,“我的标签”中的文本不再可以作为链接单击

有人能告诉我这里缺少什么吗

// Set Question Label
Question *question = self._answerForCell.question;
NSString *questionText = [NSString stringWithFormat:@"Q: %@", question.text];
CustomOHAttributLabel *thisQuestionLabel = (CustomOHAttributLabel *)[self.contentView viewWithTag:QUESTIONLABEL_TAG];

//Set up dictionary for question
NSString *questionStr = [question.text stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];

NSString *urlForQn = [NSString stringWithFormat:@"dailythingsfm://redirect_to/questions/%@/answers?text=%@&nickname=%@&question_id=%@&question_curious=%i&showEveryOneTab=%i", question.slug, questionStr, [[UserInfo sharedUserInfo] getNickname], question.qid, question.curious, 1];
NSString *qnStartIndex = @"0";
NSString *qnLength = [NSString stringWithFormat:@"%i", [questionText length]];

NSDictionary *qnDict = [NSDictionary dictionaryWithObjectsAndKeys:qnStartIndex, @"start", qnLength, @"length", urlForQn, @"url", nil];
NSArray *array = [NSArray arrayWithObject:qnDict];
[thisQuestionLabel setLabelwithText:questionText fontSize:QUESTION_FONT_SIZE andSubStringToURLArrayViaRange:array withHexColor:@"#555555"];


//Method to set the text in UILabel to a custom link
- (void)setLabelwithText:(NSString *)text fontSize:(CGFloat)fontSize andSubStringToURLArrayViaRange:(NSArray *)array withHexColor:(NSString *)textColor
{
    NSMutableAttributedString *attrStr = [NSMutableAttributedString attributedStringWithString:text];
    [attrStr setFont:[UIFont systemFontOfSize:fontSize]];
    [attrStr setTextColor:[UIColor grayColor]];
    [self removeAllCustomLinks];

    for (NSDictionary *dict in array) {
        NSString *start = [dict objectForKey:@"start"];
        NSString *length = [dict objectForKey:@"length"];
        NSString *url = [dict objectForKey:@"url"];

        NSUInteger startIndex = [start intValue];
        NSUInteger len = [length intValue];

        NSRange range = NSMakeRange(startIndex, len);

        [attrStr setFont:[UIFont boldSystemFontOfSize:fontSize] range:range];
        [attrStr setTextColor:[UIColor colorWithHexString:textColor] range:range];
        [self addCustomLink:[NSURL URLWithString:url] inRange:range];
    }

    self.attributedText = attrStr;
}

对于最新的OHAttribute Library 3.2.1,我必须使用“setLink”方法而不是addCustomLink

您是否正在实施委托方法来处理链接操作?是的。事实上我才意识到这个问题。addCustomLink方法似乎不起作用,我需要使用最新库版本“setLink”附带的另一种方法。