将NSTextAttachment图像添加到UITextView后如何调整其大小

时间:2019-06-19 08:05:15

标签: ios objective-c nstextattachment

我向UITextView添加了一张图片。附加后,我要调整大小。我试图改变但失败了。

[richTextTV.attributedText enumerateAttribute:NSAttachmentAttributeName
    inRange:NSMakeRange(0[richTextTV.attributedText length])
    options:0
    usingBlock:^(id value, NSRange range, BOOL *stop)
    {
    if ([value isKindOfClass:[NSTextAttachment class]])
    {
    NSTextAttachment *attachment = (NSTextAttachment *)value;
    CGRect bounds = CGRectMake(0, 0 , 200 , 200);
    attachment.bounds = bounds;
    }
    }];

预先感谢

0 个答案:

没有答案