UICollectionView Elements That Are Not Displayed After Migration to Swift 2

After migrating my Xcode 6 project to Xcode 7, only the first UICollectionViewin my application will display correctly.

When I switch tabs, CollectionView does not display properly.

The app worked great in iOS 8.

Example:

  • Here is the header of the CollectionView in the storyboard.

    Headline

  • When I launch my application, I get a blank view.

    Result

  • Interestingly, when I use the View Hierarchy debugger, it shows that the item actually exists.

    View Hierarchy

+4
source share
2 answers

So it seems that ios9 has an error rendering custom cells.

xibs .

viewDidLoad:

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

self.collectionView.registerNib(UINib(nibName: "SongHeader", bundle: NSBundle.mainBundle()), forCellWithReuseIdentifier: "SongHeader")
+1

, viewDidLoad .

self.collectionView!.registerClass(YourCustomMemeClass.self, forCellWithReuseIdentifier: "reuseIdentifier")
+1

Source: https://habr.com/ru/post/1608043/


All Articles