Alexander Farber
Alexander Farber

Reputation: 22958

How to align Custom cells to Right Detail and Basic cells?

I am using static cells with 4 sections to create a Settings scene:

Xcode screenshot

For some cells I use the predefined styles: Right Detail and Basic.

But for the following cells I use Custom style with my own constraints:

My problems: I can not get the leading alignment right and also my 2-lines word-wrapping Label pushes a Switch to the right:

screenshot

As you can see at the top screenshot, my constraints for the problematic Label in Custom cell are:

Please help, I wonder how other apps with Settings screens do it.

SOLUTION:

  1. I have unchecked Constrain to Margins and set Leading Space to 15 pixels (thanks Andre)
  2. I have solved my 2nd problem by lowering Horizontal Content Compression Resistance Priority of the Label to 250

Upvotes: 0

Views: 525

Answers (1)

eala
eala

Reputation: 23

If you use auto-layout,

you can turn on "Preserve Superview Margins" in

  1. Content View
  2. Your Label & Switch
  3. Your custom Table View Cell

and leave Label's leading space and Switch's trailing space to 0 (default)

Upvotes: 1

Related Questions