UICollectionView 添加 UICollectionCell [英] UICollectionView adding UICollectionCell

查看:17
本文介绍了UICollectionView 添加 UICollectionCell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试将 UICollectionCell 放入 Interface Builder 中的 UICollectionView 时,我无法以未知原因将其放入.单元格将转到工具栏而不添加到 UICollectionView

When I try to put UICollectionCell to UICollectionView in Interface Builder I can't put it with unknown reasons. The cell is going to the tools bar without adding to UICollectionView

我正在使用:

  • iOS SDK 6.0
  • XCode 4.5.1
  • 我不使用情节提要

推荐答案

只有StoryBoard里面的UICollectionView里面有UICollectionViewCell.如果使用 XIB,使用 CellName.xib 创建一个新的 XIB,将 CollectionViewCell 添加到其中,指定 UICollectionView 自定义类的名称.之后使用 registerNib.

Only UICollectionView inside StoryBoard have UICollectionViewCell inside. If use XIB, create a new XIB with CellName.xib, add CollectionViewCell to it, specify name of UICollectionView custom class. After that use registerNib.

示例代码:https://github.com/lequysang/TestCollectionViewWithXIB

这篇关于UICollectionView 添加 UICollectionCell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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