5

In Xcode 6 when I try to pin an image view to the edge of UICollectionViewCell, auto-layout creates constraints of -8.0. What changed? I've tried to find release notes or documentation updates but haven't seen anything.

  1. Notice the imageview is up against the edges of the collectionview cell

image

  1. Frame X and Y are both zero

frame

  1. Adding constraints for leading space and trailing space to container margin results in a settings of -8.0

constraints

Why is this happening and what is the preferred approach for edge to edge content?

Kyle Clegg
  • 38,547
  • 26
  • 130
  • 141

1 Answers1

8

Before you add a new constraint, you will need to untick the "Constain to Margins". It is ticked by default.

enter image description here

Ricky
  • 10,485
  • 6
  • 36
  • 49
  • Why he has to do that? whats the propose of this tick ? – Curnelious Sep 17 '14 at 12:26
  • in iOS 8, there is one new property call "layout margins" for all the views inherit from UIView. See: http://stackoverflow.com/questions/25770119/ios-8-uitableview-separator-inset-0-not-working/25788003#25788003 – Ricky Sep 18 '14 at 12:30