3
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
Resources 폴더에 –
보기 컨트롤러 초기화시 번들을'nil'으로 설정하면 앱을 다시 시작한 후에 이미지가 제대로 작동하고 있습니다. 다시 시작하지 않고도 앱 이미지를 변경할 수있는 방법이 있습니까? – Raptor