Ios 在UITableViewCell中使用NIAttributedLabel
问题:通过Actiontap在UITableViewCell中使用NIAttributedLabel,导航 在标签中添加链接 向单元格添加标签 使用操作点击将单元格添加到模型 问题是,如果我触摸链接上的标签,它实际上不会显示链接,而是执行点击操作。 但是,如果我以相同的方式在UITableViewCell中添加UIButton,则操作不会发生,当我触摸按钮时,按钮会响应。 所以我想这是标签的问题。 我怎样才能解决它 我终于明白了这一点 向文件niAttributeLabel.m添加函数Ios 在UITableViewCell中使用NIAttributedLabel,ios,uitableview,nimbus,Ios,Uitableview,Nimbus,问题:通过Actiontap在UITableViewCell中使用NIAttributedLabel,导航 在标签中添加链接 向单元格添加标签 使用操作点击将单元格添加到模型 问题是,如果我触摸链接上的标签,它实际上不会显示链接,而是执行点击操作。 但是,如果我以相同的方式在UITableViewCell中添加UIButton,则操作不会发生,当我触摸按钮时,按钮会响应。 所以我想这是标签的问题。 我怎样才能解决它 我终于明白了这一点 向文件niAttributeLabel.m添加函数 -(UI
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
// never return self. always return the result of [super hitTest..].
// this takes userInteraction state, enabled, alpha values etc. into account
UIView *hitResult = [super hitTest:point withEvent:event];
// don't check for links if the event was handled by one of the subviews
if (hitResult != self) {
return hitResult;
}
if (self.explicitLinkLocations || self.detectedlinkLocations) {
BOOL didHitLink = ([self linkAtPoint:point] != nil);
if (!didHitLink) {
// not catch the touch if it didn't hit a link
return nil;
}
}
return hitResult;
}
删除所有touchXXX中的所有[super touch XXXX]功能
然后,它工作了