How to use CoreText to draw text around images

Discussion in 'iOS Programming' started by straber, Feb 20, 2014.

  1. straber macrumors member

    Joined:
    Jul 3, 2012
    #1
    I'm trying to subclass UIView to build a control that will use CoreText to draw text around some images, where the location of the images will be determined by tags in the text I'm drawing. For example, I'd get a string like this: "Here is some text and here is the rest of the text."

    Basically, I want to replace everything between the <> with the 20x20 image it references, and draw all the text before the tag in front of it and all the text after the tag after the image.

    I would greatly appreciate any help with this.

    Thanks in advance!
     
  2. lcarli, Mar 3, 2014
    Last edited by a moderator: Mar 3, 2014

    lcarli macrumors newbie

    Joined:
    Mar 3, 2014
    #2
    BezierPath

    Use BezierPath!

    Try:
    Code:
    UIBezierPath *exclusion = (pass image);
    self.textView.textContainer.exclusionPaths = @[exclusion];
     

Share This Page