1

Is there a way to set a UITextView within a custom shape that isn't a square. Basically I want the text to fit within a circle.

I managed to make a circle border around the text.

But the text stays within a square and any text under the border gets cut off.

Don Peters
  • 91
  • 7

1 Answers1

1

UITextView has a property called exclusionPaths where you can set an array of UIBezierPath in order to avoid those areas with text. In case of a circle you will have to get the path with the form for the 4 corners of the UITextView.

You can check this post, that can help you achieve what you want.

As an alternative you could build the TextKit stack and create a custom container subclass to define the shape, but I think the exclusionPath is easier.

Community
  • 1
  • 1
Dario
  • 3,105
  • 1
  • 17
  • 16