LanguageManager-iOS
LanguageManager-iOS copied to clipboard
UITextField wrong rtl alignment with latest version
Here is a screenshot for the representing the issue:
What I tried:
- Update to latest version 1.2.3
- Install via cocoapods and carthage
- Set Arabic as default language in AppDelegate
- Setting the textfields alignment to natural
- Remove the Arabic localization and add it again
Note that I'm using a navigation controller and the rtl is working fine except for text fields.
I have same issue, did you find a solution for this ?
sam here
I'm trying to think of a solution, but until I find a solution, you can handle that in your BaseTextField
by doing something like this:
func updateTextAligment() {
if(isRightToLeft) {
self.textAlignment = .left
} else {
self.textAlignment = .right
}
}
@Abedalkareem This is my solution if it helps:
I added an extension for NSTextAlignment
import LanguageManager_iOS
extension NSTextAlignment {
static var defaultAlignment: NSTextAlignment {
return LanguageManager.shared.currentLanguage == .ar ? .right : .left
}
}
Usage
myTextField.textAlignment = .defaultAlignment
@rami965 why everyone thinks that Arabic is the single language with RTL?