【问题标题】:Ask an NSBundle for its resource name向 NSBundle 询问其资源名称
【发布时间】:2016-11-14 10:04:06
【问题描述】:

我已经为类似这样的本地化加载了BSBundle

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

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

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

【问题讨论】:

    标签: cocoa localization nsbundle


    【解决方案1】:

    基于this answer,这是可行的:

    [[bundle.bundleURL URLByDeletingPathExtension] lastPathComponent]
    

    【讨论】:

      猜你喜欢
      • 2017-05-31
      • 1970-01-01
      • 2015-06-12
      • 2014-08-21
      • 2012-01-17
      • 2010-12-12
      • 2023-04-02
      • 1970-01-01
      • 2014-04-12
      相关资源
      最近更新 更多