I make a news feed where posts of users are displayed. In the posts can be from 1 to 10 pictures. And there can be no one at all. The task is to display these pictures in one or two rows (depending on the number). The conditions are such that if the pictures are not more than three, then they are displayed in one row. If more, then in the first row only two pictures, and in the second the rest. And in each row, the pictures should be the same in height, and the row itself should be the entire width of the screen. An example of how it will look below.
How do I do this? Do I need to somehow create an imageView from the code and take it into dimensions and set all the necessary parameters? Or is it possible to implement in the StoryBoard?
In android, I made this application and there I did this: I made two horizontal rows in the UI editor with ImageView. In the first row were 3 imageView, and in the second 8. All were deactivated (GONE), i.e. completely disabled and had a size of zero so to speak. When I had to, I included the right amount (for example, two in the first row and the rest in the second) and considered dimensions based on the width of the screen by my formula so that the sum of the width of the pictures was equal to the width of the screen and the height was the same based on the aspect ratio of each picture.
What method would you recommend for the implementation of this task under iOS? And explain the desired so that it is clear to a person who not so long ago began to learn swift.
Also ready to hear other options for a compact display of a group of pictures (for example, as in VKontakte)
