Right to Left UI in iPhone (Hebrew)
Asked Answered
R

4

7

I'm struggling in creating a RTL UI in iPhone application. The framework doesn't seem to have any support for RTL languages. The only thing is the alignment inside labels, which is nice, but it conflicts with other controls behaviour.

The question is: Is there a working code for a RTL TableView? Something that would handle the disclosure buttons to be on the left, section titles to be right aligned, index view to be left aligned?

As far as I understand I cannot move the index view of the tableview, i have to overlay some custom control...

Any suggestions/pointers/examples?

p.s. this is not a duplication of this question: Right to Left Alignment for UITableView since what I am looking for is a deeper customization, not just a new type of CellView.

(Update: Mar 10) For now - I've removed support for indexView from the tableView at all, implemented the cells as custom views by myself (with disclosure buttons on the left), and customized the header/footer of the table as well. the only thing that is left is the Index View.

Residentiary answered 4/3, 2010 at 8:37 Comment(1)
I wrote a Hebrew vocabulary trainer for the iPhone and until iPhone OS 3 I had to turn around strings before I displayed them. Since 3.0 I haven't had any problems with RTL script but then I am only using the most basic controls.Temporal
A
1

I don't believe that there is a "correct" way of doing this, but here is one solution:

Within the view, create a UIView and add a UITableView to it. Add the UIView as a subView of your "master" view and specify its bounds to be off of the left side of the screen so that all but the indices is clipped by the "master" view. Now all you have to do is add a bit of code to synchronize the two tables when an index from the subview is touched.

Obviously this is not the best solution, but it is one that could work.

Good luck.

Aetolia answered 11/3, 2010 at 19:43 Comment(1)
you are right, this does seem like the solution (though it's a shame that you have to get down and dirty to get it). any chance you saw this implemented somewhere and can share a piece of code?Residentiary
N
4

Given that the built-in apps don't flip their layout when you switch the UI language to Hebrew, I think you shouldn't do it either. If your app uses a RTL layout while all other apps use a LTR layout, this might be quite confusing.

Maybe Apple will improve their RTL support one day. If you stick to standard controls, you will probably get most of these improvements for free.

Natka answered 13/3, 2010 at 13:5 Comment(0)
A
1

I don't believe that there is a "correct" way of doing this, but here is one solution:

Within the view, create a UIView and add a UITableView to it. Add the UIView as a subView of your "master" view and specify its bounds to be off of the left side of the screen so that all but the indices is clipped by the "master" view. Now all you have to do is add a bit of code to synchronize the two tables when an index from the subview is touched.

Obviously this is not the best solution, but it is one that could work.

Good luck.

Aetolia answered 11/3, 2010 at 19:43 Comment(1)
you are right, this does seem like the solution (though it's a shame that you have to get down and dirty to get it). any chance you saw this implemented somewhere and can share a piece of code?Residentiary
E
0

I think the subclassing UITableViewCell to get the behaviour you are after is the way around this. It's fairly trivial to do this.

However, I'm not quite sure how Apple would react in terms of approving the application for the AppStore. They have quite strict User Interface Guidelines which state the accessory in a table cell is on the right side of each cell... but I'm sure they would be reasonable with this given your requirement.

Eggnog answered 10/3, 2010 at 18:21 Comment(1)
Thanks, but that's not really an answer to the question, as you can see i already did subclass the TableCell, I was asking about IndexView.Residentiary
S
0

I have no experience with right-to-left-text but have you tried to set the text alignment to right?

[cell.textLabel setTextAlignment:UITextAlignmentRight];
Smriti answered 13/3, 2010 at 12:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.