如何将不同项目大小调整为不同大小的网格视图?

时间:2012-05-16 18:30:25

标签: iphone gridview

我正在尝试使用不同大小的盒子(项目)制作网格视图(三种类型)我实现了这个

https://github.com/tanin47/UIGridView

但是不能真正制作三种不同类型的单元格并在gridview中对齐它们。

我试图像这样调用不同的单元格:

- (UIGridViewCell *) gridView:(UIGridView *)grid cellForRowAt:(int)rowIndex AndColumnAt:(int)columnIndex
{
    NSMutableDictionary *dic = [testArray objectAtIndex:rowIndex * 2 +columnIndex] ;


    if ([[dic objectForKey:@"type"] isEqualToString:@"one"]) {
        Cell *cell = (Cell *)[grid dequeueReusableCell];

        if (cell == nil) {
            cell = [[Cell alloc] init];
        }
        NSLog(@"dic:%@",dic);
        //  cell.label.text = [NSString stringWithFormat:@"(%d,%d)", rowIndex, columnIndex];
        cell.label.text = [dic objectForKey:@"handa"];
        return cell;

    }
    else {
        CellTpye2 *cell = (CellTpye2 *)[grid dequeueReusableCell];

        if (cell == nil) {
            cell = [[CellTpye2 alloc] init];
        }

        NSLog(@"dic:%@",dic);
        //  cell.label.text = [NSString stringWithFormat:@"(%d,%d)", rowIndex, columnIndex];
        cell.label.text = [dic objectForKey:@"handa"];
        return cell;
    }


}

我正在进行正确的呼叫,可以在此网格视图中完成。

任何帮助表示赞赏!!

1 个答案:

答案 0 :(得分:0)

uicollectionview insets解决了对于迟到的更新抱歉的问题

相关问题