Table cell view is not right-aligned

I am trying to vertically align table cells.

simulator

I set the Semantics property to Force Right in the entire visual tree.

Desired layout:

Desired state

Visual tree:

Visual tree

There are no visual definitions in the code ...

EDIT:

Following @dirtydanee's suggestion:

trailed

+3


source to share


7 replies


Stack view configuration

For your stack representation, you must be alignment

set to Leading

so that it starts in the leading position for your language, which is the best side for you. Then set Semantic

to Force Right-to-Left

.



It is important that you snap the edges of the stack to the edges of the container so that the stack view determines the size of the container. It is also important that you give the labels a dynamic size. Both of these conditions seem to occur in your code, although it's not entirely clear.

+1


source


Just follow these steps to assign the correct side of the text in the tableviewCell

  • Step 1: select the view in contect Show cell in StoryBoard

  • Step 2: align the text to the right.



Description image

+1


source


It seems that your limits are wrong.

Move your labels to the right and align their text to the right.

Here's an example:

enter image description here

And it works on the simulator:

enter image description here

+1


source


If you use restrictions leading

and trailing

to place your items UILabel

, everything automatically switches to the correct site if the language is right to left. There is no need to change NSTextAlignment

( .natural

the default and the one you want) or UISemanticContentAttribute

for UILabel

.enter image description here


Keep in mind that at least one RTL language must be added to localize a project:

enter image description here


When your iPhone / iPad language is set to Hebrew, everything should work as expected:

enter image description here

0


source


It also depends on your device selected by Lang.

You can use left

instead leading

and use right

insteadtrailing

0


source


I tried the demo and I think you need to set semantics for each label separately

go to perekSourcelabel set semantic right to left then do the same for the title label

dont set semantic for your stack view or whole perekTableViewcell

0


source


Duplicating another well aligned scene (View Controller) and removing the damaged one are resolved.

I don't know what the problem is.

0


source







All Articles