Saalis Umer
Saalis Umer

Reputation: 21

How to access pref pane bundle?

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

Upvotes: 2

Views: 338

Answers (1)

ecleamus
ecleamus

Reputation: 71

[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"];

Upvotes: 7

Related Questions