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];
Try setting the bounds property to the image size.
bounds
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 };