iphone - SSCollectionView SSCollectionViewItem - 没有显示项目

标签 iphone ios gridview sstoolkit

我在使用 SSCollectionView 和 SSCollectionViewItem 时遇到了困难。

首先,我想从 IB 对其进行初始化。但这对我不起作用。 我有一个 SelectFooViewController 是:

@interface SelectFooViewController : SSCollectionViewController { ... }

并将其用作相应 XIB 的文件所有者。

 SelectFooViewController* selectFooVC = [[SelectFooViewController alloc]
 initWithNibName:@"SelectFooViewController" bundle:nil];

但由于它不会工作,我不得不自己在 viewDidLoad() 中初始化它的属性。

此外,除了 SSCollectionViewItems 的 backgroundColor 之外,我无法显示任何内容。我想要的是一个 textLabel 和一个 image 。

- (SSCollectionViewItem *)collectionView:(SSCollectionView *)aCollectionView itemForIndexPath:(NSIndexPath *)indexPath {
    SSCollectionViewItem *item = [[[SSCollectionViewItem alloc] initWithStyle:SSCollectionViewItemStyleImage reuseIdentifier:itemIdentifier] autorelease];

    SSLabel* label = [[SSLabel alloc] init];
    [label setText:@"foo"];
    item.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"foo.png"]];
    item.textLabel = label;
    [label autorelease];

    return item;
}

我可以确认委托(delegate)方法(用于确定行数、部分等)已按预期实现和工作。但是我的项目都是空的 - 但对预期的弹出窗口使用react。

有没有人看到我所做的错误? - 谢谢...

编辑:我也无法通过更改 SSCatalog 项目来显示本地镜像

最佳答案

我刚刚发现,我必须自己设置每个属性(textLabel、detailTextLabel 和 imageView)的框架。这样就解决了。

关于iphone - SSCollectionView SSCollectionViewItem - 没有显示项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6789143/

相关文章:

ios - 如何将 IB 中的自动布局约束从一个 View 复制到另一个 View ?

iphone - “sharedDispatcher”已弃用

ios - 动画阻止其他 UI 元素响应

C# GridView 设计

ios - UICollectionViewCell 动态宽度和固定高度

c# - LINQ外连接动态OrderBy

iphone - twitpic 与 iPhone 应用程序集成

iOS 应用程序在 Debug模式下运行正常,但在正常模式下崩溃

ios - 单词拼写建议工具提示以纵向垂直显示

ios - GCDAsyncSocket readDataWithTimeout 和 didReadData 正在截断大于 1460 字节(1 个数据包)的传入数据字符串