How to set the contentSize for a ShinobiGrid


#1

Hi,

I have a ShinobiGrid with a height of 300 px. It has 30 rows, each row having a height of 30 px. This means I can show 10 rows at a time. I also have a “selector view” that has the width of the grid and the height of a row. This view is added on top of the grid (at the coordinates of the first row). I am using this selector view to empahsize the data row that is beneath it when scrolling. So this selector row it fixed. My problem is that I want to increase the grid cotnent size with an amount that would allow me to show the last row from the grid in the confiment of the fixed selector row. Where is the best way to set the grid conent size im this case?

Regards,

Adrian


#2

try this in viewdidload method

UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, x, y)];

[self.view addSubView:scroll];

ShinobiGrid  *Grid = [[ShinobiGrid alloc] initWithFrame:CGRectMake(0, 0, scroll.frame.size.width, scroll.frame.size.height)];

.

.configure your table from datasourse

.

[scroll addSubview: Grid.view];

I hope it has helped you


#3

Hi,

Why would you add a ShinobiGrid (which is a UIScrollView based class) to another scroll view?

Adrian


#4

if not placed inside a UIScrollView simple shape of my implementation crashes when running my application on a physical device (ipad / iphone) (Shinobicontrols only said that if your demo work is not their problem). 

This use in the general implementation:

try this in viewdidload method float y; float resheight; if (IsPopover) { y=255; resheight=255; float version = [[[UIDevice currentDevice] systemVersion] floatValue]; if (version == 7) { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.3]; [UIView setAnimationBeginsFromCurrentState:YES]; CGRect rect = self.grid.frame; rect.origin.y -= 62; grid.frame = rect; [UIView commitAnimations]; } } else { y=200; resheight=200; } grid = [[ShinobiGrid alloc] initWithFrame:CGRectMake(50, y, self.view.bounds.size.width-100, self.view.bounds.size.height-resheight)]; grid.autoresizingMask = ~UIViewAutoresizingNone; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { if (!sizeOfFields) { sizeOfFields=[NSNumber numberWithFloat:250]; } if (!sizeOfRows) { sizeOfRows=[NSNumber numberWithFloat:30]; } grid.defaultRowStyle.size = sizeOfRows; grid.defaultColumnStyle.size = sizeOfFields; } else { if (!sizeOfFields) { sizeOfFields=[NSNumber numberWithFloat:50]; } if (!sizeOfRows) { sizeOfRows=[NSNumber numberWithFloat:20]; } grid.defaultRowStyle.size = sizeOfRows; grid.defaultColumnStyle.size = sizeOfFields; I hope it has helped you PD: In my case the viewContoller father inherited a toolbar at the bottom, this hides the last row so I reduced the frame, the animation is when the grid is assembled dynamically on a popover