Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with Uicollectionview for nib but didn't get a UICollectionView

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.

enter image description here

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 ?

like image 257
Martin Avatar asked Jun 16 '14 06:06

Martin


2 Answers

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

like image 135
Ardra Thambi Avatar answered Sep 29 '22 08:09

Ardra Thambi


Just remove the view in Storyboard and use the UICollectionView as direct child.

like image 32
Mohanmoorthy Avatar answered Sep 29 '22 07:09

Mohanmoorthy