4

After migrating my Xcode 6 project to Xcode 7, only the first UICollectionView in my app renders properly.

When I switch tabs the CollectionView doesn't render properly.

The app worked fine in iOS 8.

Example:

  1. Here is a CollectionView header in the Storyboard.

    Header

  2. When I run my app, I am getting a blank view.

    Result

  3. Interestingly enough, when I use the View Hierarchy debugger, it shows that the element in fact does exist.

    View Hierarchy

2 Answers 2

1

So it looks like ios9 has a bug when rendering custom cells.

I would suggest creating your custom cells in xibs and then loading them from there.

Make sure to include this in viewDidLoad:

self.collectionView.registerNib(UINib(nibName: "SongCell", bundle: NSBundle.mainBundle()), forCellWithReuseIdentifier: "SongCell")

self.collectionView.registerNib(UINib(nibName: "SongHeader", bundle: NSBundle.mainBundle()), forCellWithReuseIdentifier: "SongHeader")
1
  • Darn, we can maybe do a screen share sometime if you're still having trouble. Commented Sep 21, 2015 at 15:34
1

Make sure you add this line in viewDidLoad of your collectionView controller

self.collectionView!.registerClass(YourCustomMemeClass.self, forCellWithReuseIdentifier: "reuseIdentifier")
1
  • 1
    Interesting pattern, but Swift 2 isn't too fond of it unfortunately, I'm getting ambiguous reference to member.
    – evenwerk
    Commented Oct 23, 2015 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.