Makeshift StackView control

I’m desperately missing UIStackView and NSStackView from XOJO’s control library, so I’ve started a simple makeshift implementation:

Supports H and V layout axis and some basic distribution settings:

All that’s required is placing your controls as a child of the stack view control and setting the the priority of the IDE constraints to < Highest

Working on dynamically showing/hiding controls within the stack.

2 Likes

I made a similar control back in the API1 days: FlexGrid for Xojo - Software Design & Development by Jeremie Leroy

But I have stopped using it and prefer ARiOSMobileCollectionView from @Antonio_Rinaldi

Flexgrid was working great but I had some memory issues when loading a lot of pictures.
The big advantage of ARiOSMobileCollectionView is the use of a datasource. Only the visible controls are loaded, scrolling is handled automatically and many features wouldn’t be available without declares.
Here’s an example of ARiOSMobileCollectionView in Packr app
RPReplay_Final1669505167

2 Likes

Here’s another example of it in a horizontal scroll mode.
RPReplay_Final1669505420

1 Like

I think I remember FlexGrid!

ARiOSMobileCollectionView looks powerful too; I saw that recently, too. A little overkill for a stack view control, perhaps. :slight_smile:

I need a quick way to lay out an arbitrary number of controls evenly—the floating control island in the screenshot. I’m replacing the stock iOS toolbar below it, which has that handy flexible space item.

That looks fantastic.

1 Like

Hiding/Showing of controls in the stack. Hope to add animation.

Simulator Screen Recording - iPhone 14 Pro - 2022-11-26 at 22.44.26

Layout code is starting to get little difficult because, unlike in cocoa dev, XOJO won’t let you mix attributes. In cocoa, for example, it’s handy to derive a control’s X position (say, centerX) as a fraction of the parent’s width. If you want to equally space three objects horizontally in the parent control, you will set the centerX to be equal to the parent width with multipliers of 0.25, 0.5, and 0.75. XOJO doesn’t permit this type of mixing and matching.