Xcode 11, Swift 5, iOS проблема / вызов просмотра стека - PullRequest
0 голосов
/ 02 августа 2020

Я работаю над требованием в iOS, используя Xcode 11 и Swift 5. Представление, состоящее из 6 блоков, 5 блоков равного размера (ширина и высота), а шестое поле эквивалентно по размеру 4 из коробки меньшего размера. См. Изображение требуемого макета.

[Interface Builder View of box layout]

each of the boxes will need to contain an Image with a line of text underneath. I have only shown 3 boxes with images but all 9 will need the image and text.

I have tried numerous combinations of views, stack views and nested stack views. I have the following structure which seems to layout ok, but i keep getting hung up on various constraint errors and when running the code on simulator or on real device the layout is completely screwed up.

The main problem seems to be the one box (box 6) which is twice the width and height of the other boxes. One way i have worked this is to create a 9box stacked view - 3 boxes stacked vertically within a Horizontal stack view with the 3 rows of horizontally stacked box views. I then find the x & y co-ords of the 4 boxes for a view to be created programatically to overlay the stacked views. This seems to work but its not very elegant and I'd rather use a pure stacked view solution if one exists. The following images show the current structure.

вид структуры 1

вид структуры 2

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...