Hi, i have a gridview with dynamic number of rows and columns:
the left part is a fixed column (up to the separator blue) and is composed of a custom cell with an imageview and a label
I have not used the IGGridViewDataSourceHelper because I have a complex data structure, but I have implemented all the methods of the protocol datasource in my view controller.
I have not assigned a theme to the grid, but I configured the graphics with the available properties on the gridview, I have no problem if you need to implement a custom theme.
code:
IGGridView* gridView = [[IGGridView alloc] initWithFrame:CGRectZero style:IGGridViewStyleDefault]; [self.view addSubview:gridView]; [gridView setTranslatesAutoresizingMaskIntoConstraints:NO]; gridView.rowHeight = 70; gridView.rowSpacing = 0; gridView.rowSeparatorHeight = .5; gridView.headerTextColor = [UIColor blackColor]; gridView.headerHeight = 60; gridView.headerBackgroundColor = [UIColor defaultHeaderColor]; gridView.headerFont = [UIFont boldSystemFontOfSize:15]; gridView.fixedLeftColumnSeparatorColor = [UIColor appleBlue]; gridView.fixedLeftColumnSeparatorWidth = 1; gridView.rowSeparatorColor = [UIColor lightGrayColor];
//Constraints NSDictionary *views = NSDictionaryOfVariableBindings(gridView); [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[gridView]|" options:0 metrics:nil views:views]]; [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[gridView]|" options:0 metrics:nil views:views]];
questions:
1) I can insert a separator between the header of the columns and the grid? as for the separator of the fixed column
2) how to center the text in the header (the label "Prodotto", etc ...)? I use the default header that generates the grid with - (NSString *) GridView (IGGridView *) GridView titleForHeaderInColumn: (NSInteger) column - (NSString *) GridView (IGGridView *) GridView titleForHeaderInFixedLeftColumn: (NSInteger) column
3) how to insert a separator between columns? Should I make a grid like excel
4) I can not set a minimum width of the columns, if I have many text compresses as shown: when the columns reach the minimum width, the grid should become scrollable
Hi,
it's a bug!!
now it all works.
Mattia
Looks like thats a bug!
For now, you need to implement the gridView titleForHeaderInColumn: method.
You don't actually have to return a usable value though, you can return nil if you'd like.
-SteveZ
Hello again...
I implemented
-(IGGridViewHeaderCell *)gridView:(IGGridView *)gridView headerCellAt:(NSInteger)column
- (IGGridViewHeaderCell *)gridView:(IGGridView *)gridView fixedLeftHeaderCellAt:(NSInteger)column
instead of
- (NSString*)gridView:(IGGridView*)gridView titleForHeaderInSection:(NSInteger)section;
- (NSString*)gridView:(IGGridView*)gridView titleForHeaderInFixedLeftColumn:(NSInteger)column;
the tableview works, but this two method are not called and as a result I no longer see the header
Glad I was able to help!
For Header Cells, you should derive from IGGridViewHeaderCell:
- (IGGridViewHeaderCell *) gridView:(IGGridView *)gridView headerCellAt:(NSInteger)column;
thanks Stephen, it was so simple ....
to create a custom header I have to make a subclass of IGGridViewCellBase as for a cell? Thank you!