我们如何访问Pref Pane Bundle for Mac OS app ??? 我已将图像和其他资源放在pref窗格包中,但我无法使用以下路径: NSString * path = [[NSBundle mainBundle] pathForResource:@“tick”ofType:@“png”];
其中tick.png出现在NewPrefPane.prefPane的资源文件夹中
答案 0 :(得分:7)
[NSBundle mainBundle]
返回System Preferences应用程序的NSBundle,因为那是实际运行窗格的那个。
如果您只需要在NSPreferencePane类中使用捆绑方法:
[self bundle]
在窗格代码中的其他位置使用 bundleForClass :
即
NSString * path = [[NSBundle bundleForClass:[self class] pathForResource:@"tick" ofType:@"png"];