RTL (Right to left) problem and suggestion to solve it + asking for new option
Idomo opened this issue · 12 comments
When using the library with device that it's main language is RTL (right to left) the right/left arrows are replacing positions and it's a little bit confusing.
Beside fix the arrows to not be language directional
, I'd like to suggest add an configuration option to use up/down arrows thats won't make this problem with RTL languages to be so visible and also allow choose different appearance.
It will be awesome if this configuration will be in the AppDelegate.swift
so it will change it all over the application.
In additional to the last sentence I'd like to ask adding an option to change the buttons as UIBarButtonItem
and not just as text, so we will be able to change it to buttons like Done
, Save
etc. that already found as default in the iOS and also translating automatically and make the button bold in some cases, right now the only way to do that is to config it manually to each UITextField
, it will be much better to have an option to change that at the AppDelegate.swift
.
Thanks,
Ido.
-
I tried changing the language to Arabic but couldn't reproduce the issue where the left and right button are swapped position. Is there any other settings that I need to change to make it happen?
-
The fact that one can change button titles system-wide and custom each instance using UIBarButtonItem is by-design. I wanted to make it easy for common case (changing titles, in case of localisation, for example), while open for customisation (advanced usage like using UIBarButtonItem).
But there are workarounds to help you achieve what you want. You can create helper method for example. Or you can subclass UITextField and UITextView, in the subclasses, you can customize the navigationFieldToolbar as you want.
@T-Pham the issue is that the buttons are swapped where it shouldn’t (and in my case I’m using Hebrew as the device language).
Note that in safari for example, there are up/down buttons and the “Done” button is bold like it should be, it’s better UI/UX for iOS users.
You right, I didn’t thought about this option, thanks (:
This is a bit confusing to me. So, in Hebrew:
- Should the buttons be placed as
< >
or> <
to be considered correct? - Should the
>
button navigate tonextNavigationField
orpreviousNavigationField
?
This is really interesting in fact. Just tried to change my phone language to Hebrew. Now in Safari, the <
button goes back one page and the >
goes forward one page. The ^
and v
buttons do not change behaviour though.
@T-Pham It should be like in any language, directions are international.
I’m not sure if the right arrow should move to the next/prev, thats why I think up/down buttons will be much easier to understand and also will look more native as you can see them in safari, mail and etc.
Fixed the button labels for RTL languages in version 4.1.
I will look into the issue with up/down icons later as this will require adding a bundle to the library because the up/down icons are images.
I will look into the issue with up/down icons later as this will require adding a bundle to the library because the up/down icons are images.
Hi, I'v found those characters for up/down arrows, but I think if you can add images that will match safari, mail and etc. (as you can see in the image I'v posted here) it will be better.
UITextField_Navigation.Config.nextButtonTitle = "∨"//⤺
UITextField_Navigation.Config.previousButtonTitle = "∧"//⤻
@T-Pham one more thing I think I'v missed in this thread is asking you the add an option to make the buttons (or at least the Done button) bold, when changing their values from the AppDelegate
instead of doing that in each page manually (delete all the buttons and then add all of them again just for bold text is too much work).
BTW, what about the up/down arrows addition?
Actually I think the problem with having to repeatedly make the Done button bold in each page can be solved by refactoring on the app side. We can create helpers or subclasses or something else depending on the actual case. The thing is the library does provide a way to make the Done button bold, best practises like DRY can be achieved on the app side.
I didn't have time to look into the up/down arrow issue.
I would also need to consider the fact that we would need to include a bundle with image files into the library, which I probably don't want to.
Actually I think the problem with having to repeatedly make the Done button bold in each page can be solved by refactoring on the app side. We can create helpers or subclasses or something else depending on the actual case. The thing is the library does provide a way to make the Done button bold, best practises like DRY can be achieved on the app side.
Now I remembered that you told me something about doing this via extension.
You can add to the README some example like this if someone will be interested in this like me:
extension NavigationFieldToolbar {
public override func didAddSubview(_ subview: UIView) {
doneButton.style = .done
previousButton.image = FASOcticons().chevronUpIcon(size: 22).image
nextButton.image = FASOcticons().chevronDownIcon(size: 22).image
}
}
I think using this library would be helpful: pod 'FontAwesomeSwift/Octicons'
https://github.com/charles-oder/FontAwesomeSwift/blob/master/FontAwesomeSwift/Octicons/FASOcticons.swift
It's a very small library (only 3 files) and it doesn't have too much icons, but it is have the up/down arrows icons! (see all of them here: https://octicons.github.com/)
So just use octicon-chevron-up/down
and thats it, you don't have to add any photo to your library.