0

I am trying to get this done using AttributedString.

Is there a way to have horizontal line with words in the middle?

I need similar to this

Bonnke
  • 896
  • 1
  • 12
  • 24
  • you can achieve this by using three label with auto-layout. – balkaran singh Oct 23 '19 at 06:47
  • @balkaransingh You are totally right, but my method to build that cell in a message application, force me to use AttributedString. Thats why I asked for AttributedString. – Bonnke Oct 23 '19 at 09:42

1 Answers1

0

you can achieve this by using three label with auto-layout

enter image description here

i give constraint to center label(Today 08.30) center horizontal and center vertical to viewcontroller.

enter image description here

just change the Hugging Priority of center label(Today 08.30) to 1000 enter image description here

now your center label adjust his width accoding to your text.

give backboard color to other two label.

balkaran singh
  • 2,754
  • 1
  • 17
  • 32
  • You are totally right, but my method to build that cell in a message application, force me to use ```AttributedString```. Thats why I asked for AttributedString. – Bonnke Oct 23 '19 at 09:42