0

I want to do something like this view (I don't know even name it) but I don't know where to start to do it the most efficient (the most less amount of code) way.

I want to do this tag/label/text with same functionality like Apple Mail has. Facebook Messenger has almost the same. Is there some official high level public API for that? Where is the best place to start? TextKit? UITextInput? Can you provide me at least abstract algorithm or point me to some inspirational place?

enter image description here

user500
  • 4,519
  • 6
  • 43
  • 56

4 Answers4

0

You could do this if the text is going to be a UILable:

  1. Add the QuartsCore framework to your project.

  2. At the top of the .m file of your View Controller put: #import <QuartzCore/QuartzCore.h>

  3. Add this code to the viewDidLoad method:

    self.myLabel.layer.backgroundColor = [UIColor blueColor].cgColor; //set the background color
    self.myLabel.layer.cornerRadius = 10 //set the corner radius
    
67cherries
  • 6,931
  • 7
  • 35
  • 51
0

There some components you can accomplish that:

AMTagListView

HKKTagWriteView

csk
  • 418
  • 1
  • 5
  • 11
0

You need to draw the text yourself. Here is an example similar to what you are looking for.

SMTagField

enter image description here

sylvanaar
  • 8,096
  • 37
  • 59
0

Instead of using addition framework, I recommend UICollectionView to implement Tags. It's less code, less overhead and easy to implement.

Follow this link for implementing:

https://codentrick.com/create-a-tag-flow-layout-with-uicollectionview/

This is how it looks like. Please note it is flexible too, you could integrate according to your logic.

enter image description here

Hope this will help you