TKEntityPropertyGroupView
allows you to arrange the editors in the group using different layouts that confirm to TKLayout
protocol through its layout
property. By default the group view uses TKStackLayout
, but you could easily change it to let's say TKGridLayout
. The code snippet below shows how to change the layout of a group view:
groupView.collapsible = YES;
if (groupIndex == 0) {
TKGridLayout *grid = [[TKGridLayout alloc] init];
groupView.editorsContainer.layout = grid;
NSInteger row = 0;
NSInteger col = 0;
for (UIView *editor in groupView.editorsContainer.items) {
TKGridLayoutCellDefinition *editorDefinition = [grid definitionForView:editor];
editorDefinition.row = @(row);
editorDefinition.column = @(col);
col++;
if (col == 2) {
row++;
col = 0;
}
}
}
groupView.collapsible = true
if groupIndex == 0 {
let grid = TKGridLayout()
groupView.editorsContainer.layout = grid
var row = 0
var col = 0
for editor in groupView.editorsContainer.items {
let editorDefinition = grid.definition(for: editor as! UIView)
editorDefinition?.row = row as NSNumber!
editorDefinition?.column = col as NSNumber!
col += 1
if col == 2 {
row += 1
col = 0
}
}
}
groupView.Collapsible = true;
if (groupIndex == 0) {
TKGridLayout grid = new TKGridLayout ();
groupView.EditorsContainer.Layout = grid;
int row = 0;
int col = 0;
foreach (UIView editor in groupView.EditorsContainer.Items) {
TKGridLayoutCellDefinition editorDefinition = grid.DefinitionForView (editor);
editorDefinition.Row = new NSNumber (row);
editorDefinition.Column = new NSNumber (col);
col++;
if (col == 2) {
row++;
col = 0;
}
}
}