Answer the question
In order to leave comments, you need to log in
NSImage.initWithContentsOfFile how to deallocate memory correctly in Objective-C with ARC?
I have a simple OS X application that needs to frequently (very, very often) take a picture from a file on disk and change its dock icon to it.
Here's how I do it now.
Initialization
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
self.iconX = [[NSImage alloc] initWithContentsOfFile: @"/Users/test.png"];
}
[self.iconX initWithContentsOfFile: @"/Users/test.png"];
[NSApp setApplicationIconImage:self.iconX];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question