dar*_*vin 4 macos cocoa objective-c nsattributedstring
当我通过 NSAttributedString 将图像附件放置在 NSTextField 中时,当我单击它或更改它时,图像会消失。怎么了?
NSTextAttachment* attachment = [[NSTextAttachment alloc] init];
NSImage *symbolImage = [NSImage imageNamed:@"enabled.png"];
NSLog(@"%@", symbolImage);
NSTextAttachmentCell *anAttachmentCell = [[NSTextAttachmentCell
alloc] initImageCell:symbolImage];
[attachment setAttachmentCell:anAttachmentCell];
return [NSAttributedString attributedStringWithAttachment:attachment];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
918 次 |
最近记录: |