我正在使用新的Text Kit API向某些带属性的文本添加附件:
// create an attachment for each image
NSTextAttachment* ta = [NSTextAttachment new];
ta.image = [UIImage imageNamed:@"imageName"];
// add to the attributed text string
NSAttributedString* rep = [NSAttributedString attributedStringWithAttachment:ta];
[myAttributedTextString appendAttributedString:rep];
这个工作正常,我可以看到我的图像呈现在输出中。然而,我找不到任何方法来指定图像对齐方式,或让文本环绕图像。
有什么想法吗?
注意: 文本附件与排除路径不同 - 文本附件是“模型”的一部分,即它是布局管理器执行文本布局的属性文本字符串的一部分。而排除路径是视图的一部分。