我正在开发一款应用程序,其中有一个切换按钮,可以在英语和阿拉伯语之间进行切换,并且应该是实时的。我使用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())
}
该IT技术相关内容需要重新加载具有本地化字符串和RTL的根,但使用的是英语storyboard而不是阿拉伯语。
尝试通过以下方式强制加载阿拉伯语版本:
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle(path: NSBundle.mainBundle().pathForResource(LanguageManager.currentLanguageCode(), ofType: "lproj")!))
但不幸的是,它加载了故事板却没有图片。它无法读取任何资源图像。