我正在开发一个具有切换按钮的应用程序,该按钮可以在英语和阿拉伯语之间进行切换,并且应该是实时运行的。我正在使用https://github.com/maximbilan/ios_language_manager中的方法,并且在所有情况下都可以正常使用,除非情节提要通过接口而非字符串本地化:
现在,当我像这样重新加载根视图控制器时:
func reloadRootVC(){
let delegate : AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
delegate.window?.rootViewController = (storyboard.instantiateInitialViewController())
}
Run Code Online (Sandbox Code Playgroud)
它使用本地化字符串和RTL重新加载根目录,但使用英语故事板而不是阿拉伯语故事板。
尝试用力加载阿拉伯语,如下所示:
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle(path: NSBundle.mainBundle().pathForResource(LanguageManager.currentLanguageCode(), ofType: "lproj")!))
Run Code Online (Sandbox Code Playgroud)
但不幸的是,它加载了情节提要,但没有图像。它无法读取任何资源图像。