Krelborn / KILabel

A simple to use drop in replacement for UILabel for iOS 7 and above that highlights links such as URLs, twitter style usernames and hashtags and makes them touchable.
MIT License
470 stars 132 forks source link

Question about touchesBegan in touchesEnded #75

Open ronnie70 opened 7 years ago

ronnie70 commented 7 years ago

In the touchedEnded method, there's this code:

if (touchedLink)
{
        NSRange range = [[touchedLink objectForKey:KILabelRangeKey] rangeValue];
        NSString *touchedSubstring = [touchedLink objectForKey:KILabelLinkKey];
        KILinkType linkType = (KILinkType)[[touchedLink objectForKey:KILabelLinkTypeKey] intValue];

        [self receivedActionForLinkType:linkType string:touchedSubstring range:range];
}
else
{
        [super touchesBegan:touches withEvent:event];
}

What's the purpose of the "else" part? It causes problems, when embedding your KILabel in a UITableViewCell. didSelectCell is given the wrong indexPath at some point when tapping around the UITableView. I commented the "else" part out, and all seems to work fine after that.