How to wrap text around attachments using iOS7 Text Kit?

后端 未结 3 1562
自闭症患者
自闭症患者 2021-01-31 20:09

I am using the new Text Kit API to add attachments to some attributed text:

// create an attachment for each image
NSTextAttachment* ta = [NSTextAttachment new];         


        
3条回答
  •  既然无缘
    2021-01-31 20:33

    Try setting the bounds property to the image size.

    Defines the layout bounds of the receiver's graphical representation in the text coordinate system.

    So it should be:

    ta.bounds = (CGRect) { 0, 0, ta.image.size };
    

提交回复
热议问题