2

For some reason, using a collection view inside a view controller which is embeded throws UIView-Encapsulated-Layout on the collection views constraints.. i can't set height or top/bottom margins,

Any ideas as to why this happens?

I've been adding constraints through storyboard, I've even tried adding them programmatically

bevbomb
  • 689
  • 2
  • 12
  • 26
  • Try setting translatesAutoresizingMaskIntoConstraints to false. – Anna Dickinson Dec 31 '14 at 01:21
  • I've tried that, i even tried adding the constraints programmatically – bevbomb Dec 31 '14 at 01:25
  • Did you ever find a solution to this? – Can Poyrazoğlu Jun 08 '15 at 11:38
  • 1
    @CanPoyrazoğlu It seems to only do it when I haven't got a hard coded height, I also found that when its embedded calling to retrieve the bounds of the collection view on the parent viewDidLoad doesn't get the correct size, something for you to keep in mind! My advise is to programmatically add it as a child view and add the constraints – bevbomb Jun 08 '15 at 22:38
  • 1
    @CanPoyrazoğlu also another issue I had along the way is when using custom layouts with mathematically calculated sizes caused issues with the embedded view because the view seems to load at a different times, so using the size of the collection view to calculate the size of cells and spacing always had the wrong results – bevbomb Jun 08 '15 at 22:41
  • @bevbomb thank you a lot for your feedback. I've been struggling with this issue for two days, hope it works now :) – Can Poyrazoğlu Jun 08 '15 at 22:44

0 Answers0