swift - iOS layouts for a beginner -


So I consider myself to be a relatively bright person, not talented, but not a fool, but I would also like to understand its basic fundamental principles. IOS is unable to understand and amazed that if someone can be able to talk to me which will be helpful.

Especially I am working on an image panel with an image view and a CollectionView view. I have tried to get the image in the form of a header, but every tutorial that I have tried does not work (one problem I have seen recurring with iOS development).

So I put an image view with obstacles on the top, left and right so that it would sit in the middle of the top at the top. My problem is that when I put a view of the collection below the image, it either disappears (most of the time if I combine any obstruction) or it's top or bottom (as in the back) sitting on the ImageView Is there any concept of relative obstacles? Why is it so difficult in iOS? Is there a work tutorial that I do not need to do layout coding? Is it a better code for me that the storyboard is the best time sync I have ever seen?

Your thoughts and help will be highly appreciated.

This should work only. Try it (I tried and showed both image view and collection view):

demo 1 demo 2

What did I do:

  • Add
  • Add collection view with left, right and left constraints;
  • Add up, left and right barriers;
  • Add height constraints in the image view;
  • Force Uiimageview to see the relative compilation of the top + uiimageview height.

Result:

Enter image details here


Comments