문제

I'm using InAppSettingsKit in my iPad app, including localized Strings for English, German and Japanese. Everything works just fine, but I would like to be able to switch languages in-app, and this does not seem to be supported by InAppSettingsKit. Here's my showSettings method:

// show the inapp settings view
-(void) showSettings
{
  IASKAppSettingsViewController *settingsViewController = [[IASKAppSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
  settingsViewController.delegate = self;
  settingsViewController.showDoneButton = YES;

  UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:settingsViewController];

  [self presentModalViewController:navController animated:NO];
}

so the settings VC is recreated every time, but appears to re-use the language selection from the initial app start.

The user's language selection is written both to my private "language" setting in [NSUserDefaults standardUserDefaults] as well as the "AppleLanguages" array.

Where/how is the old language information cached?

도움이 되었습니까?

해결책

This is the standard behavior of iOS and usually you shouldn't aim to change it. You could probably change it using the AppleLanguages key (or some other key) in NSUserDefaults but AFAIK the current language is always static after app launch.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top