Size to Fit/Shrink to Fit View Width


#1

Greetings Programs!

In my iPad app, I have my view in a Container View. I would like to have the grid shrink to fit to the width of the view and size the fonts accordingly.

Is this possible?

Thanks!

Wg


#2

Hi Wg,

The grid doesn’t currently support this - you are going to have to ‘shrink’ the grid yourself. You can easily set small fonts and row heights as follows:

_shinobiDataGrid.defaultRowHeight = @15;
_shinobiDataGrid.defaultHeaderRowHeight = @15;
_shinobiDataGrid.defaultCellStyleForRows.font = [UIFont systemFontOfSize:10.0f];
_shinobiDataGrid.defaultCellStyleForHeaderRow.font = [UIFont systemFontOfSize:10.0f];

But it’s up to you to work out the fonts and heights you need!

Colin E.


#3

Thanks Colin!

That’s what I was doing but not setting the width of the cells. I thought they might by default set themselves to the width of the text in the header. No worries though, I will set it manually.

Wg