I have iPhone application using storyboard with two language (Arabic / English) how i can switch from Arabic localization storyboard to English storyboard without need to change language iPhone settings (At run time)
I have resolved you can do it as the following below code :
UIStoryboard *storyBoard;
if ([language isEqualToString:@"ar"]) {
lan = [[NSLocale preferredLanguages] objectAtIndex:0];
storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone5Arabic" bundle:bnd];
}
else if([language isEqualToString:@"en"]) {
NSLog(@"DDD ");
lan = [[NSLocale preferredLanguages] objectAtIndex:20];
storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone5English" bundle:bnd];
}
NSBundle *bnd = [NSBundle bundleWithPath:[[NSBundle mainBundle]pathForResource:lan ofType:@"lproj" ]];
UIViewController *initViewController = [storyBoard instantiateInitialViewController];
[self.window setRootViewController:initViewController];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With