我是IOS开发的新手,我尝试使用UIcollectionView来显示照片。
我从新文件 - > iOS - > User Interface - > View创建一个xib file ,并添加一个Collection View ,如下图所示。
但是当它崩溃时我得到了以下错误日志。
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UICollectionViewController loadView] loaded the "AITLocalGridViewController" nib but didn't get a UICollectionView.'而且似乎没有调用viewDidLoad
我搜索了一些信息,一些信息表明我没有在xib文件中连接集合视图
但我不明白它的意思。
有人可以帮我,教我怎么做?
I am new for IOS development , and I try to use UIcollectionView to show the photo.
I create a xib file from New file -> iOS -> User Interface -> View , and add a Collection View like the following picture.
But I got the following error log when it crash.
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UICollectionViewController loadView] loaded the "AITLocalGridViewController" nib but didn't get a UICollectionView.'And it seems didn't call viewDidLoad
I have search for some information , some information indicated that I dint not connect the collection view in xib file
But I don't understand what it mean.
Could some one help me and teach me what to do ?
最满意答案
确保您已将UIcollectionview IBOutlet与您在程序中声明的“ collectionview ”相关联。 此外,您还应该建立委托和数据源连接(为此,请单击Uicollectionview中的Uicollectionview。选择Connection Inspector。在哪里可以看到delegate和datasource 。按住Ctrl键拖动并将其连接到文件所有者。)
Make sure that you have connected UIcollectionview IBOutlet with “collectionview “ that you declared in your program. And also you should make delegate&data source connection(For making this, click on th Uicollectionview in the xib. Select Connection Inspector. Where you can see delegate and datasource.By pressing ctrl button drag and connect it to File’s Owner.)
更多推荐
发布评论