How do I get the button to stay right in the cell for all sizes?

I am trying to add a custom checkbox button ( https://codereview.stackexchange.com/questions/69123/ibdesignable-uicheckbox ) to my prototype view cell in my storyboard.

This is where the album ends, starting with what it looks like on all three iPhone sizes and ending with a picture of my Builder interface: http: // imgur. com / d 6ejxEL, 9NpqcnA, 4gdLnMT, g24FYID # 0

How can I check the box where it will appear on iPhone 6 at all three sizes? Thanks in advance.

+3


source to share


2 answers


You have to add auto-layout constraints. In storyboards, you can add an auto layout to keep the button on the right:
I used a radio button to demonstrate.

1) Select "Button".

2) Click the icon below, circled in red.



3) Limit the space between the superview (content view) and the "Button".

You can add various constraints such as top or left spacing.

4) Click "Add # restrictions"

+2


source


Add check mark constraints to your layout. You can do this by right-clicking or clicking on the + button. You will need at least two (the limit is from a check mark to the top of the content, and the other is in trailing space).



One constraint will keep it upright, one will keep it horizontal.

+1


source







All Articles