UICollectionView Using Swift

后端 未结 4 2170
生来不讨喜
生来不讨喜 2020-12-18 09:01

In My Project I created Cell in UICollectionViewCell

Its got Error Terminating app due to uncaught exception

The code as follow.

GalleryCell.

4条回答
  •  轮回少年
    2020-12-18 09:32

    I added the following two lines in NextViewController.swift under viewDidLoad():

    var nibName = UINib(nibName: "GalleryCell", bundle:nil)
    
    collectionView.registerNib(nibName, forCellWithReuseIdentifier: "CELL")
    

    The problem was that I was not registering the nib. Now that I'm doing that, it's working fine.

提交回复
热议问题