Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8028179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:03:31+00:00 2026-06-05T00:03:31+00:00

I am using NIAttributedLabel for displaying links on text. NIAttributedLabel *label; label = [[NIAttributedLabel

  • 0

I am using NIAttributedLabel for displaying links on text.

            NIAttributedLabel *label;
            label = [[NIAttributedLabel alloc] initWithFrame:rect];

            label.delegate = self;
            label.font = [UIFont fontWithName:@"Helvetica" size:MAIN_FONT_SIZE];
            label.textAlignment = UITextAlignmentLeft;
            label.lineBreakMode = UILineBreakModeWordWrap;
            label.numberOfLines = 0;
            label.backgroundColor = [UIColor clearColor];
            label.highlightedTextColor = [UIColor whiteColor];  
            label.text = strEditedText;
            label.textColor = [UIColor blackColor];

            [label setTextColor:[UIColor blueColor] 
                          range:[strEditedText rangeOfString:stringPh]];  

But last line is not working correctly although stringPh is in strEditedText. All the text is coming in blue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:03:34+00:00Added an answer on June 5, 2026 at 12:03 am

    I set up an example which you can download here, and I found that it worked perfectly.
    With:

    NSString * strEditedText= @"I'm text";
    NSString *stringPh = @"I'm";
    

    the simulator correctly highlights the right portion of the text:
    enter image description here

    Are you absolutely sure your string stringPh is an actual substring of strEditedText?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Java, how can I extract all the links from a given web page?
Using Rails 3 and ActiveModel, I am unable to use the self. syntax to
Using WebViewBrush I can render web page content (it's screen shot) to e.g. Rectangle
Using Jenkins or Hudson I would like to create a pipeline of builds with
Using PyGtk's IconView, I can set the icons to be reorderable by calling gtk.IconView.set_reorderable(True)
Using Java,I have to fetch multiple sets of values from an XML file to
Using MVVM. I have a DataTemplate which I am using to display an expander
using chrome and ff so far have made a nasty glitch when using scrollTo
Using SQL Server 2000 Table1 Id date --- ---------- 001 23/01/2012 002 25/01/2012 003
Using Yii, I want to delete all the rows that are not from today.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.