CollectionView背景clearColor无法正常工作 [英] CollectionView background clearColor not working

查看:121
本文介绍了CollectionView背景clearColor无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个小型的collectionview'框架',就像iPad上的浏览器标签栏(想想chrome)一样。代码全部完成,自定义流程布局,重新排序等,并按如下方式组织:

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包含高逻辑集合视图(委托+数据源方法)。我有xib来配置collectionView设置并设置自定义流布局(我可以通过编程方式执行此操作,但是这样更容易)。

• 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(流程布局的子类)

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

•TabBarCell .h / .m / .xib(collectionviewcell的子类)

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

然后我在我的主viewController上添加TabBarCVC作为childViewController(这个viewController有很多childViewController和子视图),然后作为子视图。
此时所有工作都是fiiiiine。

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.

现在问题是,它太愚蠢我无法相信我没有办法做到这一点, collectionView的backgroundColor无法设置为clearColor 。我可以把它放在灰色或任何颜色,但它不支持透明度。单元格背景颜色也很明显并且确实有效。

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.

我需要将collectionView透明化以在后面的主视图上显示纹理。任何洞察都会非常感激,或者我可能会将我的第一个雷达填充到苹果。

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.

如果我找不到任何解决方案,我只需添加'截图'应该在collectionView后面的纹理,并将其添加为collectionView的backgroundView中的imageView。

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.

推荐答案

好的,所以我'我觉得现在很傻。我留下了一个空的UIView,作为collectionView的容器进行测试。我只是忘了删除它,现在一切都工作得很好用一个漂亮的clearColor ...

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

这篇关于CollectionView背景clearColor无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆