6
  1. I am passing some urls to the UITextView and they are detected using UIDataDetectorTypeLink. Now I'm in need to change the color of the link(url) to some uicolor. I have no idea on how to do this.

    Here is the code showing my attempt:

    [textview_Url setEditable:NO];
    [textview_Url setScrollEnabled:NO];
    [textview_Url setDataDetectorTypes:UIDataDetectorTypeLink];
    [textview_Url setText:web];

    It gives blue, and I want to change that color.

  2. By UIDataDetectorTypeLink, a long press only asks conformation to redirect to the link. But I want to show some alert to ask confirmation if someone just touches it. Is there a way to do this ?

3
  • 2
    Welcome to Stack Overflow ! Feel free to show us any code you have ! Sep 28, 2012 at 7:58
  • @AxelIsouard: ok [textview_Url setEditable:NO]; [textview_Url setScrollEnabled:NO]; [textview_Url setDataDetectorTypes:UIDataDetectorTypeLink]; [textview_Url setText:web]; but by default it gives blue color, i want to change the color it.. any idea???? Oct 1, 2012 at 11:55
  • Hi downvoter, Why DownVote? Feb 3, 2014 at 6:16

3 Answers 3

3

Use this:

self.textView.linkTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
2

Solved

I have used globalTintColor property of window,

like,

self.window.tintColor = [UIColor redColor];

Output:

enter image description here

2

The better approach is self.textView.tintColor = [UIColor redColor]; This change only links(phones) to red color.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.