3
iPhone App用にローカライズされた画像が2セットあります。イメージをどのように置くべきですか?アプリにどのように読み込むことができますか?iOS:ローカライズされた画像を管理する
フォルダ構造は以下の通りです:
For English version:
/MyApp/en.lproj/Localizable.strings , InfoPList.strings
/MyApp/en.lproj/*.png (images)
For Traditional Chinese version:
/MyApp/zh-Hant.lproj/Localizable.strings , InfoPList.strings
/MyApp/Resources/*.png (images)
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *locale = [[defaults objectForKey:@"AppleLanguages"] objectAtIndex:0];
NSString* path= [[NSBundle mainBundle] pathForResource:locale ofType:@"lproj"];
NSBundle* languageBundle = [NSBundle bundleWithPath:path];
SomeViewController *vc = [[SomeViewController alloc] initWithNibName:@"SomeViewController" bundle:languageBundle];
私は画像の両方のセットのために同じファイル名を使用し、それをオートロードしたいと思います。出来ますか?
問題が発生しました。デバッグコンソールでは、次のように述べています。
NSBundle </Users/SomeUser/Library/Application Support/iPhone Simulator/5.0/Applications/1DC22505-1E78-4B5E-A794-DBF72DC786AE/MyApp.app/zh-Hant.lproj> (not yet loaded)
どうすれば解決できますか?
イメージはどこに置く必要がありますか?同じフォルダ( '/ MyApp/Resources /'や '.lproj'の中のすべて)? – Raptor
Resourcesフォルダ –
ビューコントローラの初期化でbundleを 'nil'に設定した場合、アプリケーションを再起動してもイメージは正常に動作しています。再起動せずにアプリイメージを変更できる方法はありますか? – Raptor