3
我有2套iPhone應用程序本地化圖像。我應該如何放置圖像?我怎樣才能加載到應用程序?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 2012-02-22 06:54:16
在Resources文件夾中 – 2012-02-22 06:54:47
如果我在視圖控制器的初始化中將bundle設置爲'nil',則在重新啓動應用程序後,圖像效果不錯。有什麼方法可以在不重新啓動的情況下更改應用圖片嗎? – Raptor 2012-02-22 07:40:32