How to access pref pane bundle?

343 Views Asked by At

How do we access Pref Pane Bundle for Mac OS app??? I have placed images and other resources inside the pref pane bundle, but I am not able to get the path using: NSString * path = [[NSBundle mainBundle] pathForResource:@"tick" ofType:@"png"];

where tick.png is present in the resources folder in NewPrefPane.prefPane

1

There are 1 best solutions below

0
On

[NSBundle mainBundle]

returns the NSBundle for the System Preferences application since that is the one that is actually running your pane.

Use the bundle method if you just need it in your NSPreferencePane class:

[self bundle]

Use bundleForClass elsewhere in your pane code:

i.e.

NSString * path = [[NSBundle bundleForClass:[self class] pathForResource:@"tick" ofType:@"png"];