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];
ta.bounds = (CGRect) { 0, yPadding, ta.image.size };
change yPadding you need. It can be negative when image's height is large than line height.