nebuto nebuto - 1 month ago 17
iOS Question

CollectionView background clearColor not working

I'm developing a small collectionview 'framework' to behave like a browser tab bar (think chrome) on the iPad. The code is all done, custom flow layout, reordering, and so on and is organized as so :

• TabBarCollectionViewController .h/.m/.xib contains the high logic of the collection view (delegates + datasource methods). I have the xib to configure the collectionView settings and set the custom flow layout (I could do this programmatically, but oh well it's easier that way).

• CustomFlowLayout .h/.m (subclass of flow layout)

• TabBarCell .h/.m/.xib (subclass of collectionviewcell)

Then I'm adding the TabBarCVC as a childViewController on my main viewController (this viewController has many childViewController and subviews) and then as a subview.
At this point all is working fiiiiine.

Now the problem, it's so stupid i can't believe i haven't found a way to do this, the backgroundColor of the collectionView is not settable to clearColor. I can put it in gray or whatever color, but that it doesn't support transparency. The cell background color is also clear and does work.

I need the collectionView to be transparent to show the texture on the main view behind. Any insight would be much appreciated, or perhaps i'll fill my first radar to apple.

If i can't find any solution i'll just add the 'screenshot' of the texture supposed to be behind the collectionView and add it as a imageView in the collectionView's backgroundView.

Answer

Ok so i'm feeling pretty stupid now. I left an empty UIView behind, acting as a container for the collectionView for a test. I simply forgot to remove it, all is working fine with a nice clearColor now...