How do I size rows?


#1

I’ve created my grid in the storyboard as I have an explicit size that I need.  The grid is just static content, with 2 rows and 10 columns.  How do I tell the grid that each row should take exactly 1/2 the height of the grid?


#2

ShinobiGrid

You can set the minimumSize property on the defaultRowStyle object of your grid like so:

grid.defaultRowStyle.minimumSize = [NSNumber numberWithFloat:grid.frame.size.height/2];

Or you could implement the delegate method shinobiGrid:styleForRowAtIndex:inSection: to return an appropriate SGridColRowStyle object, letting you size each row dynamically. (The first option will be best for your use case, I just included the latter option for completeness.) 

ShinobiDataGrid

Set the defaultRowHeight on your grid as shown below (defaultHeaderRowHeight for header cells):

grid.defaultRowHeight = [NSNumber numberWithFloat:grid.frame.size.height/2];

If you wanted to size the rows dynamically (again, probably not what you want in this situation) then you could implement the SDataGridDelegate shinobiDataGrid:heightForRowInSection: method, returning the correct height you want for that row.

Jan