Uicollectionview为nib发出问题,但没有得到UICollectionView(Issue with Uicollectionview for nib but didn't g

编程入门 行业动态 更新时间:2024-10-24 18:19:58
Uicollectionview为nib发出问题,但没有得到UICollectionView(Issue with Uicollectionview for nib but didn't get a UICollectionView)

我是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.)

更多推荐

本文发布于:2023-04-28 00:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329657.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有得   但没   nib   Uicollectionview   UICollectionView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!