Search code examples
iosxamarin.iosuitextviewnsattributedstringnsmutableattributedstring

Change attributed text color with link IOS


How I can change the attributed text color from blue to white?

When I click on the UITextView the app opens the url, I just need to change the color to white.

My code is in C# but I think it can be converted to swift or objective-c easily.

I have tried this way but it didn't work:

NSMutableAttributedString footerText = new NSMutableAttributedString(myFooterText, new UIStringAttributes
        {
            ForegroundColor = UIColor.White,

            Link = new NSUrl(myLinkString)
        });

        //Set footer text
        MyTextView.AttributedText = footerText;

enter image description here


Solution

  • I fixed it by implementing normal text view with my custom text color and the underline, On user click I open the browser with my url.