Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTL Support #161

Closed
ahmedraad opened this issue Apr 1, 2018 · 7 comments
Closed

RTL Support #161

ahmedraad opened this issue Apr 1, 2018 · 7 comments

Comments

@ahmedraad
Copy link

ahmedraad commented Apr 1, 2018

Hi There
I've been used this amazing library, but i'm having a little issue with direction in Arabic localization, so it's there any method to make start index from right side ?

screen shot 2018-04-01 at 4 03 09 pm

Thanks

@rechsteiner
Copy link
Owner

Hi! You can select items manually using the select(index:) method. In your case, you can probably do something like this:

switch UIView.userInterfaceLayoutDirection(for: view.semanticContentAttribute) {
    case .leftToRight:
      pagingViewController.select(index: 0)
    case .rightToLeft:
      pagingViewController.select(index: 3)
}

Let me know if that works for you. I will also look into adding RTL support directly to Parchment 👍

@rechsteiner
Copy link
Owner

@ahmedraad did you get this working?

@Athenay
Copy link

Athenay commented May 8, 2018

Hi @rechsteiner !
Your answer works for changing selection of menu item in RTL views and for situation which the number of menu items cover entire of the screen, but i have just two tab and need to insert them on screen from right to left (i dont want to fix them to cover entire screen). do you have any idea about this situation ?

@ahmedraad
Copy link
Author

Hi @rechsteiner
sorry i was too busy, i've tried this way, it's work but i have a lot of filtering & inserting & removing data , so should i do more logic and i don't want that
i hope you can fix the layout
Thanks

@Pratik948
Copy link

Hey guys, I have workaround for this RTL languages. I am using datasource and delegates for PagingViewController and I have an array of titles for all items. when my app uses RTL semantics I reverse the array using something like this

if UIView.appearance().semanticContentAttribute == .forceRightToLeft {
        self.items.reverse()
}

and when the paging controller is added to view controller I set its index to last like this

if UIView.appearance().semanticContentAttribute == .forceRightToLeft {
        self.pagingViewController.select(index: self.items.count - 1, animated: false)
}

I hope this helps other people too

And @rechsteiner thank you so much for your awesome contribution to community

@aerow69
Copy link

aerow69 commented Nov 12, 2019

I have second workaround. You can transform PagingViewController, PagingCell and embeded view controllers by:
view.transform = CGAffineTransform(scaleX: -1, y: 1)

@rechsteiner rechsteiner mentioned this issue Mar 12, 2020
4 tasks
@rechsteiner
Copy link
Owner

The new version with proper RTL support is finally out now! https://github.com/rechsteiner/Parchment/releases/tag/v3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants