michaelloistl / ContextLabel

A simple to use drop in replacement for UILabel written in Swift that provides automatic detection of links such as URLs, email, phone number, twitter style usernames and hashtags.
MIT License
109 stars 20 forks source link

Taping links does not work on iPhone 11 with more than 1 line #34

Open igorkulman opened 4 years ago

igorkulman commented 4 years ago

I have been using ContextLabel for quite some time and never encountered a problem. But now with iOS 13 and have a very specific issue.

If I have a ContextLabel with more than 1 line, say 2 lines and the hyperlink is on the second line, tapping it does not work on iPhone 11. On smaller and older phones, like SE, it still works fine. It is also reproducible on the iPhone 11 simulator.

I did some debugging and the problem seems to be in getting the character index of the tapped position in https://github.com/michaelloistl/ContextLabel/blob/master/Source/ContextLabel.swift#L822. On iPhone 11 it is always the index if the same place but on the first line or 0.

So no matter where I tap on the second line the ContextLabel thinks I click the first line.

FarisAlbalawi commented 2 years ago

PR #39