向NSBundle询问其资源名称

时间:2016-11-14 10:04:06

标签: cocoa localization nsbundle

我为这样的本地化加载了BSBundle

NSURL *const bundleURL = [[NSBundle mainBundle] 
                           URLForResource:localizationName 
                            withExtension:@"lproj"];

NSBundle *const bundle = [NSBundle bundleWithURL:bundleURL];

...我如何(其他地方)通过向localizationName发送消息来回复bundle

1 个答案:

答案 0 :(得分:0)

基于this answer,这有效:

[[bundle.bundleURL URLByDeletingPathExtension] lastPathComponent]