从XIB加载AQGridViewCell(不工作) [英] Load a AQGridViewCell from XIB (not working)

查看:122
本文介绍了从XIB加载AQGridViewCell(不工作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 AQGridView 类和我我正在尝试从 XIB 加载一个单元格。我已将 XIB 设置为 UITableView 的自定义单元格,但是当我尝试加载单元格时,它只是空白。我想知道是否有更简单的方法来加载 XIB

I am using AQGridView class and I am trying to load a cell from an XIB. I have setup the XIB like a Custom Cell for a UITableView, but when I attempt to load the cell, it is simply blank. I was wondering if there was an easier way to get the XIB to load.

- (AQGridViewCell *) gridView: (AQGridView *) gridView cellForItemAtIndex: (NSUInteger) index
{
    static NSString * CellIdentifier = @"cellID";
    gridCell * cell = (gridCell *)[gridView dequeueReusableCellWithIdentifier: CellIdentifier];
    if ( cell == nil ){
        gridCell = [[gridViewCell alloc] initWithFrame: CGRectMake(0,0,_gridView.frame.size.width/2-4, 
                                                                       _gridView.frame.size.height/2-8) 
                                       reuseIdentifier:CellIdentifier];
        cell = gridCell;
        self.gridCell = nil;
    }

    cell.title = @"Test Grid Item";
    cell.date  = @"Apr. 7, 2011";

    return ( cell );
}


推荐答案

这是一篇文章,描述了如何使用示例代码从nib加载AQGridViewCell。查看名为可重用的AQGridViewCell的部分。

Here's an article that describes how to load an AQGridViewCell from nib, with example code. Check out the section called "A reusable AQGridViewCell".

(感谢pt2ph8指出 contentView 。)

(Thanks to pt2ph8 for pointing out contentView.)

这篇关于从XIB加载AQGridViewCell(不工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆