我现在拥有的是
View :
1.UILabel : show a text
2.A GMGridView : show a grid of views
代码是
- (void)viewDidLoad
{
[super viewDidLoad];
gridViewHolder.itemSpacing = SPACING;
gridViewHolder.dataSource = self;
gridViewHolder.actionDelegate = self;
}
#pragma mark - GMGridViewDataSource
- (CGSize)GMGridView:(GMGridView *)gridView sizeForItemsInInterfaceOrientation:(UIInterfaceOrientation)orientation {
return CGSizeMake(WIDTH, HEIGT);
}
- (NSInteger)numberOfItemsInGMGridView:(GMGridView *)gridView {
return [needs count];
}
- (GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index {
cell = [gridView dequeueReusableCell];
CGSize size = [self GMGridView:gridViewHolder sizeForItemsInInterfaceOrientation:UIInterfaceOrientationPortrait];
if (!cell)
cell = [[GMGridViewCell alloc] init];
UIView *innerView = [[UIView alloc] initWithFrame:CGRectMake(COOR_X, COOR_Y, size.width, size.height)];
innerView.backgroundColor = [UIColor grayColor];
cell.contentView = innerView;
return cell;
}
所以现在我可以成功地在 gridview 中显示一堆视图。但是,当我滚动网格视图时,网格视图的内容将覆盖标签。下面是图片,这样你就可以看到我现在的情况
如何避免这种情况,以便每当我向上滚动我的 gridview 时,它的内容不会与我的 uilabel 重叠