Correct way to insert an image into NSTextView.
Correct way to insert an image into NSTextView.
- Subject: Correct way to insert an image into NSTextView.
- From: Gus Mueller <email@hidden>
- Date: Fri, 6 Feb 2004 18:05:26 -0800
I've got a program where I'm inserting an image from the filesystem into
a NSTextView. However, after the image is inserted, the file is still
held onto (by the textview I think). So if a user tries to delete the
file via the trash, they will get a message saying it's still in use.
Here's the snippet of code I'm using:
NSFileWrapper *filew = [[[NSFileWrapper alloc]
initWithPath:@"path/to/file.pdf"] autorelease];
NSTextAttachment *fileAttatchment = [[[NSTextAttachment alloc]
initWithFileWrapper:filew] autorelease];
NSAttributedString *fileAttString = [NSAttributedString
attributedStringWithAttachment:fileAttatchment];
[textView insertText:fileAttString];
Is there another way I should be doing this?
thanks,
-gus
--
August 'Gus' Mueller
Flying Meat Inc.
http://flyingmeat.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.