0

What is the easiest way to accomplish something like the image below? As you can see the first two lines should have bigger insets than the others. I've tried looking into changing the insets for each line but found nothing.

I am also trying to stay away from too complicated solutions like detecting line breaks and then splitting the string into multiple strings.

Is there an easy way to do this?

enter image description here

JP Aquino
  • 3,946
  • 1
  • 23
  • 25
  • Probably not possible with UILabel - certainly not "an easy way." You might want to take a look at this question - might find inspiration from it, or you might be able to modify one of the answers to work for your needs: https://stackoverflow.com/questions/14214900/drop-cap-with-nsattributedstring – DonMag Sep 06 '17 at 16:04
  • 1
    I would suggest you to look for `TextKit` tutorials... – sCha Sep 06 '17 at 16:11
  • `NSAttributedString` to have a bigger first letter. Using a `UITextView` (if you set it not editable/selectable) it will act as a `UILabel` and use `exclusionPath` could do the trick. – Larme Sep 06 '17 at 16:12
  • Check [these search results](https://stackoverflow.com/search?q=uilabel+wrap+image). – rmaddy Sep 06 '17 at 16:28
  • 3
    There is actually "an easy way." to do this with a UIBezierPath as the excludedPaths of your textview. Take a look at this answer its only 2 lines of code, very simple: https://stackoverflow.com/a/20033752/3543861 – MSU_Bulldog Sep 06 '17 at 16:29

0 Answers0