简体   繁体   中英

I want change my own app language on button click in iOS

if(btn.tag==1)
{
    [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"];
    [[NSUserDefaults standardUserDefaults]synchronize];
}else{
    [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"ar", nil]  forKey:@"AppleLanguages"];
    [[NSUserDefaults standardUserDefaults]synchronize];
}

but it's not changing language for the first time first I select language and restart the app then it change the language but not change for the very first time

Thanks

I don't think you can change the language, once it's set. Thats why you get it right, after the next time you launch the app.

If you already knew this, then please explain your question a bit more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM