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 133 forks source link

Fix issue with indexPath in didSelectRowAtIndexPath when a cell contains KILabel #45

Open asenchuk opened 8 years ago

asenchuk commented 8 years ago

Related to #30

It looks like copy-paste issue when a chunk of code at the touchesEnded was copied from touchesBegan and after super's touchesEnded super's touchesBegan is being called.

Main.storyboard was updated to make a cell selectable. KILabelTableViewController.m updated with logging so you can check issue.

To reproduce the issue revert my changes in KILabel.m and try the following steps: 1) tap first cell - indexPath is 0-0 (correct) 2) tap second cell - indexPath is still 0-0 (wrong) 3) tap second call again - indexPath is 0-1 (correct) 4) tap first cell - indexPath is 0-1 (wrong) 5) tap first cell again - indexPath is 0-0 (correct)

Hope you will check this PR asap because it's very useful pod.

ADDED: fix for the crash caused by adding nil color to a dict

asenchuk commented 8 years ago

... and. nothing?

mobilefellow commented 8 years ago

I fixed the issue by removing for following code from "- (void)touchesEnded:(NSSet )touches withEvent:(UIEvent )event.

else { [super touchesBegan:touches withEvent:event]; }

I guess the author copied code from "- (void)touchesBegan:(NSSet )touches withEvent:(UIEvent )event" by mistake.

nazywamsiepawel commented 7 years ago

@mobilefellow thank you. I have just wasted two hours on this, taking my project (quite large) apart and going more crazy every minute. It was one of the most bizarre and random bugs I have seen this year. I'm so happy it works now.