Reputation: 1748
In Flex, there are such things as HGroup and VGroup. They allow to align content horizontally and vertically with some prespecified gap between elements.
Is there something simular in Cappuccino? I cannot find any information about layouts in Cappuccino anywhere (except automatic layout, which is not what I need).
Upvotes: 2
Views: 120
Reputation: 1758
Like Primalmotion said, there's no built in class to do this. However, making your own container view isn't difficult: https://gist.github.com/3630322
I'll leave the horizontal layout view as an exercise for you.
Explaining this just a little bit:
At the end of the Cappuccino run loop each view does two things: "layout subviews" and "redraws" itself. Basically what happens is when a view gets modified (for example, a new subview gets added) the views sets a flag saying that it needs to update the content on the screen. We can actually control how that layout happens by overriding the method that gets called:
- (void)layoutSubviews;
This is extremely powerful, and very efficient because it means the view only "renders" itself once during a run loop.
EDIT: I should note, that code was not tested at all. I believe it should work unless there's some weird typo :)
Upvotes: 2
Reputation: 91
There is no stuff like that in Cappuccino. But you can do the same thing with auto resizing masks. What can't you achieve with auto layout?
Upvotes: 1