New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attributedLabel(_ label: NantesLabel, didSelectLink link: URL) doesn't seem to be working #8
Comments
TL;DR, it doesn't look like you're doing anything wrong as far as Nantes is concerned. (Guessing here) I would take a look at the frame of your label to make sure the constraints are correct, so when you tap, you're tapping inside the label's frame still. Longer version: Here's my version:
I removed the constraints you had setup with SnapKit, since my stackview will handle laying the label out for me, and changed the add to subview, since it's going into the stackview instead of a view, but that shouldn't bother anything related to the link working. If I had to guess around your issue, maybe the frame is not set correctly for the label in your view? If you use the view inspector and take a look at the frame around it, is it painting outside the frame (so it can't handle taps, since you might be tapping outside of it)? My example project in the repo has something almost exactly like the one you're trying to recreate. The |
Hmm I made a new project with SnapKit and Nantes, it looks like it's working fine for me there too. I copied all your code except the stackview part inside So maybe the issue is that it's still behind another view and it can't capture taps? I'm not really sure what's blocking you here. Just a quick sanity question, you're tapping "Privacy Policy" in the label right? Not "Sign Up"? :) |
Right. That's why I was confused. In my actual project I have it in a stackview embedded in a scroll view without using snapkit at all. I removed it and tried the snapkit layout to rule out the stackview and scroll view as an issue. I'll try checking out the view inspector and let you know either way. |
Also, I've tried tapping literally every pixel of the label. :) |
Okay, so it seems like the problem was an unrelated problem...I had a tap gesture recognizer set on the view to dismiss the keyboard when a user taps outside of any of the textfields on the form. It seems like that's overriding the touch handling of the NantesLabel. I would like to preserve that behavior if possible. I've tried |
Thanks for taking a look! |
Thanks for the issue! I'll start putting the FAQ together. |
Cool, let me know if you'd like any help with it. I'd be happy to help work with you to draft it or to proofread or anything. |
First off, thanks so much for making an awesome looking label replacement. In our app I'm currently doing a lot of work to manually calculate sizes in a UITextview for fields rendering markdown. I think this might be a great replacement if I can work out some of the kinks.
I'm currently using this to try to make something like this:
Anyway, thanks in advance for making it, and hopefully it's just user error on my part.
Describe the bug
Cannot get a link to trigger the delegate
didSelectLink
callback.To Reproduce
Create a view controller and add code like this:
Expected behavior
I expected to see the link that was tapped printed to the console.
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: