[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Theming non-main-app images
From: |
Richard Frith-Macdonald |
Subject: |
Re: Theming non-main-app images |
Date: |
Thu, 19 Nov 2015 07:13:18 +0000 |
> On 19 Nov 2015, at 06:21, Richard Frith-Macdonald <address@hidden> wrote:
>
>
>> On 17 Nov 2015, at 17:47, Riccardo Mottola <address@hidden> wrote:
>>
>> Hi,
>>
>> I want to be able to theme the recycler bin icons of GWorkspace.
>>
>> The icons themselves are in "many places" I find the Recycler icon in three
>> places:
>>
>> Framework: /FSNode/Resources/Images/Recycler.tiff
>> GWorkspace app: /GWorkspace/Resources/Icons/Recycler.tiff
>> Recycler app: Recycler/Resources/Images/Recycler.tiff
>>
>> The code however is done like this:
>>
>> NSBundle *bundle = [NSBundle bundleForClass: [FSNodeRep class]];
>>
>> imagepath = [bundle pathForResource: @"Recycler" ofType: @"tiff”];
>
>
>> I think this code is done so that the Framework's Resource, indepdendently
>> if it is called from inside GWorkspace or Recycler.
>>
>> Can I "theme" a Framework by specifying a bundle idnentifier?
>
> Yes, it sounds like you can.
> You use -pathForImageResource: rather than -pathForResource:ofType:
> Each bundle will give you a different image (the one from the theme which
> corresponds to the bundle’s identifier).
Just to be clear … the [NSBundle-pathForImageResource:] is from a category in
the gui library, and is theme-aware, but the [NSBundle-pathForResource:ofType:]
methoid is from the base library and not theme-aware.
So a theme aware app needs to use -pathForImageResource: to load its own
images, but if it does so, it should get the image the theme defines for the
bundle (as determined by the bundle identifier).