1

i have a UITableView that contains a prototype cell holding labels , each label subbed in a view , all views stacked in a vertical UIStackView and i have a constrain for the stack ,,

xcode design mode

at runtime in iphone SE

iPhone SE screenshot

unless I set stack width for 414 ( for iphone 6+ ) it will appear like

iPhone 6+

i don't want to set fixed width , but the constrains not applied correctly ,, what i have missed here

joern
  • 27,354
  • 7
  • 90
  • 105
shahed
  • 21
  • 4

1 Answers1

0

Set leading, trailing, top and bottom constraints of stackView equal to leading, trailing, top and bottom constraints of content view in your table view cell. Change constant of constraint how you want to.

delete centerX and centerY constraints, you don't need them if you set it how I wrote above

In storyboard

Just select stack view and click to Add New Constraint icon. Then set value of leading, trailing, top and bottom constraint and click to Add 4 Constraints

enter image description here

Robert Dresler
  • 10,580
  • 2
  • 22
  • 40