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

  • SEARCH
  • Home
  • 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 8588211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:45:14+00:00 2026-06-11T22:45:14+00:00

How would I elegantly achieve multiline text that includes a combination of links, plain

  • 0

How would I elegantly achieve multiline text that includes a combination of links, plain text, and formatted words? Right now, all I can think of is breaking each word into a token and displaying/positioning it differently (UILabel, UIButton, etc), however, this is terribly inefficient. Here is an example of what I am trying to achieve from the comments feature in Instagram.

Instagram comments

Notice, formatted link to user name, indented multiline text, and possibility of inline links to hashtags.

  • 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-11T22:45:15+00:00Added an answer on June 11, 2026 at 10:45 pm

    Edit Sep 14

    So I was able to implement something very similar using FTCoreTextView
    It was simple to import/implement. I am using the code as a static library in my ARC project.

    The following are the core components:

    • I use a method to set the style for my cell’s FTCoreTextView

       (NSArray *)getCoreTextStyle{
          NSMutableArray *result = [NSMutableArray array];
      
          FTCoreTextStyle *defaultStyle = [FTCoreTextStyle new];
         defaultStyle.name = FTCoreTextTagDefault;    //though the default name is already set to FTCoreTextTagDefault
         defaultStyle.font = [UIFont fontWithName:@"Helvetica Neue" size:14.f];
         defaultStyle.textAlignment = FTCoreTextAlignementLeft;
         [result addObject:defaultStyle];
      
      
             FTCoreTextStyle *linkStyle = [defaultStyle copy];
         linkStyle.name = FTCoreTextTagLink;
         linkStyle.color = [UIColor blueColor];//[del colorWithHexString:@"3aa98"];
             linkStyle.font = [UIFont fontWithName:@"Helvetica Neue" size:14.f];
          [result addObject:linkStyle];
      
              return  result;
       }
      
    • Then in your cell you would set the text for the view, assign a delegate, etc. (My FTCoreTextView overrides a plain IBOutlet for a UIView)

      [myFTTView setDelegate:self];
      [myFTTView addStyles:[self getCoreTextStyle]];
      [myFTTView setText:[self parseLinks:text]];
      [myFTTView setNeedsDisplay];
      
    • Parse links is a method i separately define to search for hashtags and usernames and then set a style when they are found (this code is rough and leaves much to be improved. I am considering switching to CoreTextHyperlink which already has code search for hashtags and @usernames.)

      -(NSString *) parseLinks: (NSString *)cap{
         NSArray *split = [cap componentsSeparatedByString:@" "];
         NSMutableArray *words = [[NSMutableArray alloc] initWithArray:split];
      
            for (NSString *word in split){
      
               if([word hasPrefix:@"#"] || [word hasPrefix:@"@"]){
      
                  NSString *reformat = [NSString stringWithFormat:@"%@%@|%@%@", hashlink,word, word, endhashlink];
                  [words replaceObjectAtIndex:[split indexOfObject:word] withObject:reformat];
              }
      
          }
          return [words componentsJoinedByString:@" "];
      }
      
    • Last but not least, the method called after a tag/username is clicked

      - (void)coreTextView:(FTCoreTextView *)acoreTextView receivedTouchOnData:(NSDictionary *)data {
      
          NSString *key = [data objectForKey:@"url"];
          if([key hasPrefix:@"#"]){
             //do something for tag
          }
         else{
            //do something for user.
         }
      
         return;
      
         }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm curious how the Python Ninjas around here would do the following, elegantly and
What would be an elegant way of comparing 2 symbolic links in Unix? Assume
Would be possible to extend this kind of layout so that I can have
Basically I want to achieve a tuple (or any datatype that fits my problem)
I'm parsing some text and calculating the weight based on some rules. All the
Im trying to achieve the following effect in rails: If the text is bigger
I would like to create a set of persistent objects that load their state
I have a list of objects in python that I would regularly check and
I would like to resize a list of images, all in the directory. To
I would like to achieve something similar to the following in Guice: public MyClass

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.