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 using this answer...

How to style UITextview to like Rounded Rect text field?

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

Community
  • 1
  • 1
Don Peters
  • 91
  • 7

1 Answers1

0

You should use a UITextKit (a very good tutorial).

Probably you will have something like:

UIBezierPath* exclusionPath = [UIBezierPath bezierPathWithOvalInRect:yourTextView.bounds];
exclusionPath = [exclusionPath bezierPathByReversingPath];
yourTextView.textContainer.exclusionPaths = @[exclusionPath];
Avt
  • 16,927
  • 4
  • 52
  • 72