TTTAttributedLabel可点击截断令牌

我有一个TTTAttributedLabel并为它指定了一个自定义的截断标记:

NSAttributedString *atributedTruncationToken = [[[NSAttributedString alloc] initWithString:@" More..." attributes:@{ NSForegroundColorAttributeName : [UIColor lightGrayColor], NSFontAttributeName : self.messageLabel.font, NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType // no effect }] autorelease]; [self.messageLabel setAttributedTruncationToken:atributedTruncationToken]; 

它看起来很完美,但我怎样才能使令牌可点击?

(特别是,当用户点击令牌时我需要扩展标签,而不是标签的其余部分)。

UPDATE。 正如我所知,有可能(iOS 7+)添加一个指向令牌的链接,如下所示:

 NSAttributedString *atributedTruncationToken = [[[NSAttributedString alloc] initWithString:@" More..." attributes:@{ NSForegroundColorAttributeName : [UIColor lightGrayColor], NSFontAttributeName : self.messageLabel.font, NSLinkAttributeName : [NSURL URLWithString:@"..."] }] autorelease]; 

但是在TTTAttributed标签中有一种错误(?),令牌仍然没有变得可点击,但标签文本的n( n = token length )最后一个字符呢!

ResponsiveLabel是UILabel的子类,可用于配置可点击的截断标记。

 NSString *expansionToken = @"Read More ..."; NSString *str = @"Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; NSMutableAttributedString *attribString = [[NSMutableAttributedString alloc]initWithString:kExpansionToken attributes:@{NSForegroundColorAttributeName:[UIColor blueColor],NSFontAttributeName:self.customLabel.font}]; [self.customLabel setAttributedTruncationToken:attribString withAction:^(NSString *tappedString) { NSLog(@"Tap on truncation text"); }]; [self.customLabel setText:str withTruncation:YES];