Hello,
I would like to put some html content inside a Label (or something else if needed).
I managed to do a Custom renderer so that the html is displayed in the Label.
On Android there is no problem with making the links clickable, but on iOS the UILabel doesn't have the "shouldInteractWithURL" attribute, only UITextView has it.
Is there a way to make the html links clickable on both iOS and Android?
Thank you.
Posts
I found a solution, if someone needs it, here is the code of the custom renderer for iOS:
Hi! I tried this solution, but I get an error saying: "Cannot convert from 'UIKit.UITextView' to 'UIKit.UILabel'". You didn't have a problem with that?
Thanks!
Did you copy/paste the whole code? The inherited class is ViewRenderer<Label, UITextView> which shouldn't cause any error with UILabel.
Aha, that did the trick
thank you for a quick reply!
Hi again! Before I tried your solution for clickable links, I could convert the html to rich text, but the links were not clickable. Now, the links are clickable, but the html tags show. Does it show rich text in your solution? Thanks!
Hi,
I'm sorry I still have access to the code but I can't test it, I think that this piece of code in the custom renderer should do the trick:
Thank you, that fixed my problem!