0

i have some text and i want to add this text to UILabel in style like this: (x+y)³ but instead ³ some text. How can i do this in swift, help me please?

Skie
  • 91
  • 1
  • 2
  • 13

1 Answers1

1

That what you are looking for is a Mutable Attributed String. Here is a nice answer on Stackoverflow: Attributed Strings in Swift

Alternatively, you can subclass UILabel, and draw the text yourself in drawRect. If you do it this way, just add an instance variable to tell you how much of the string to draw in one format, and draw the rest in another.

Or as a obvious solution: you create another UILabel at the end of the first UILabel.

Community
  • 1
  • 1
Jonas
  • 2,139
  • 17
  • 38