Change language for a loaded tabbarController in ios - ios

I want to change the language of the loaded tabbar controller from the app when the user selects the language from the tableview

You should rather use the language the user applied to the whole OS. (link)
Apple provides a nice macro called NSLocalizedString, you might want to check that out.
Example:
// Localizable.strings (German)
"Edit" = "Bearbeiten";
// code
label.text = NSLocalizedString(#"Edit", nil);

Related

Reset Appearance for button font conditionally

My App supports two languages. Language can be changed within the app. For buttons I have set font through appearance property in app delegate. I need two different fonts based on language. I am setting it like,
if language == "en" {
UIButton.appearance().titleLabel?.font = UIFont.systemFontOfSize(18)
} else {
UIButton.appearance().titleLabel?.font = UIFont(name: "Cairo", size: 18)!
}
When language is changed then I am invoking above code but it looks like it sets to the one which gets called first time at the time of app launching.
I followed few threads & it suggests to handle it manually on each controller for relevant UI components. But looks quite lengthy work.
Any clues to sort out my issue where I can set appearance based on my language?

How disable change language in number pad in iOS Objective C?

I have texFiled I'm my view controller and i set number pad for that like this:
self.phoneTextField.keyboardType = UIKeyboardTypeNumberPad;
And now i want user just can enter english number in text field(can not change language)
(This only applies for iOS 10 or later and for number pad)
Swift
yourTextField.keyboardType = .asciiCapableNumberPad
Objective C
yourTextField.keyboardType = UIKeyboardTypeASCIICapableNumberPad;
NO,we can't disable or Hidden the keyboard properties, it is not possible to handle the default property of Keyboardtypein iOS, if you want to make it own customization then you go for Custom Keyboard Concept. else try once with another keyboard Types
Choice 2
in that place you can add one Overlay for disable , you can get the sample from here.but
If Apple figures out that the key is covered or. disabled they will most likely reject the app.

Possible to hide a button on particular language in iOS with base localization?

I'm new to localization. I've got my app mostly converted, but I have a case where a button only appears in the US English version of the app, but no other languages. Is this possible using main.strings and localizable.strings?
Jakub Vano's answer is pretty useful, but also you can set that string with a special value as "notToShow" and do this
if ([NSLocalizedString(#"MyString", nil) isEqual:#"notToShow"]){
//hide button
}
If we are talking code, you can check current locale via
[[NSLocale currentLocale] localeIdentifier]
and show / hide button accordingly. If you are using storyboard / xib, you can have separate interface for each localization.

Change the view controller app launches with when button is clicked - Xcode

I'm attempting to create an introduction to my iOS app. So I've created a few view controllers that are shown in the beginning of the app. On the last introduction view controller there is a button which brings you to "the actual app".
How do I make it so when that button is clicked the app launches with a different view controller.
If someone could walk me through the steps and be very detailed I would appreciate it as I'm a beginner iOS developer.
One option is to store whether "view intro" is set to true/false & set this value in NSUserDefaults. Check that value when the app starts & put an if/else to load the appropriate VC. You might want to make the button "skip" intro entirely & set this value. People generally get annoyed w/long intros & want to use your app. See this answer about NSUserDefaults.
I am assuming you are creating an "app tutorial" type of introduction. Also assuming that you only want this to occur the first time the user uses the app, then go directly to the app every other time.
I would store a didWatchTutorial BOOL value in the NSUserDefaults.
This would also need to include an if/else statement in the opening view controller of your app, which controls (based on this BOOL value) if the user should be shown the tutorial:
if (didWatchTutorial) {
//GO STRAIGHT TO APP
} else {
//SHOW TUTORIAL
}

How does waze change objects location with their localization?

The first image is when the language is set to Hebrew, the second is in English. Look at the word " Thanks: " in the image. How Waze managed to change the location of the word to a Right To Left language? With regular localization
Thanks:x
should have been
תודות:X
That's just one example. Waze does that a lot.
Waze supports iOS 4.3 and later so AutoLayout is out of the question. With regular localization I know you can change the content of the word but location? that's a first.
Can I set an if iphone language is English then change the layout to..? (if so that's a lot of ifs.."
Thanks
Frankly, I do not know if there is any standarized way of doing that.
But I see several options:
1. Using localized .xib files or even full storyboards.
2. Changing that programmatically. Get the current localization and add some IFs to the view controller and re-arrange the items. If this is in a custom UITableViewCell subclass then overwrite the layoutSubViews (or so) and change the layout accoring to the locale settings. If you layout it within cellForRowAtIndexPath then apply the localization there.

Resources