Fred Kiefer wrote:
Am 17.11.2015 um 18:47 schrieb Riccardo Mottola <riccardo.mott...@libero.it>:
NSBundle *bundle = [NSBundle bundleForClass: [FSNodeRep class]];

imagepath = [bundle pathForResource: @"Recycler" ofType: @"tiff"];
trashIcon = [[NSImage alloc] initWithContentsOfFile: imagepath];
You should be using pathForImageResource: here.

Right, that is cleaner! I'll fix that. However it doe snot change the basics here: the "path" is the Framework path and not the current running application path. This way it is not themable.

If using imageNamed, shouldn't the App resources be used, and thus be themable? In that case I'd need to provide the icons in all apps that use this icon, in our case GWorkspace and Recycler (and the theme should override both). Not very clean, but bearable..


When using imageNamed: you should leave out the extension.

Actually, the Apple doc says that it works both way, but it would be convention to use the extension if a file name is given (like here) and no extension if it is the name for a constant.

Does it make any sense?

Having an extension is acutally cumbersome for theming, because you need to override in the theme the image with the asme extension as the app. (not only a TIFF instead of a PNG, but even TIFF vs TIF)

Riccardo

_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to