I am trying to add a GMGridView to a subview in my nib file, but I can't seem to figure out how to do this because GMGridView keeps taking up all the space in my nib generated view, and covers everything else.
This is what I am trying (pasting just parts of code to make it more readable):
- (void)viewDidLoad {
[super viewDidLoad];
_gmGridView.mainSuperView = self.gridView;
}
- (void)loadView {
[super loadView];
self.view.backgroundColor = [UIColor whiteColor];
NSInteger spacing = INTERFACE_IS_PHONE ? 10 : 15;
GMGridView *gmGridView = [[GMGridView alloc] initWithFrame:self.gridView.bounds];
gmGridView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
gmGridView.backgroundColor = [UIColor clearColor];
[self.gridView addSubview:gmGridView];
_gmGridView = gmGridView;
_gmGridView.style = GMGridViewStylePush;
_gmGridView.itemSpacing = spacing;
_gmGridView.minEdgeInsets = UIEdgeInsetsMake(spacing, spacing, spacing, spacing);
_gmGridView.centerGrid = NO;
_gmGridView.actionDelegate = self;
_gmGridView.dataSource = self;
}
Is this the right approach, or should I create another nib with the GMGridView in it, and add that one to my subview?
Thanks in advance to anyone!
You should make the following:
GMGridView *gmGridView = [[GMGridView alloc] initWithFrame:self.gridViewContainer.frame];
_gmGridView.clipsToBounds = YES;
, without this option the Cells will be floating outside the container view.Hopes that's help.