2

I'm using swift. iOS 10.

I have blur/vibrancy views in the storyboard and I have another view (which contains labels, and a collection view) that I'm putting inside the vibrancy view.

The problem is that the collection view's cells (which are red buttons) look really lame when they're inside a vibrancy view (they get all discolored and faded and it doesn't look good). The label's look great though.

Is there some way I can turn vibrancy off for the collection view, but leave it on for the labels, etc?

I tried adding the collection view to a UIVisualEffectView with effect = nil. But that didn't turn it off.

Maybe there's some way to get the buttons to look better, so that could possibly be a solution too. But to keep it simple, I was just looking to see how I can turn vibrancy "off" for a specific subview of the vibrancy view.

Ethan G
  • 1,353
  • 2
  • 15
  • 31
  • Would understand better if we can see storyboard & actual screens... – sCha Sep 19 '17 at 14:37
  • I can't really give screen shots because it's company stuff. But it's a very simple question in terms of what I want to be able to do (not necessarily easy to solve, but a simple concept) so I don't think screenshots or the storyboard would help much. – Ethan G Sep 19 '17 at 14:40
  • Probably not, but you could "fake" it. It all gets down to the view hierarchy. *"...that I'm putting inside the vibrancy view."* You cannot selectively "turn off" a section of a view. But again, if you rearrange the view hierarchy (if such a thing is possible) to have a contain view at the very top containing (a) the views you want vibrancy "turned off" on along with (b) the vibrancy view containing the views you want "turned" on, then sure. It really gets down to (1) your view hierarchy and (b) full layout. –  Sep 19 '17 at 14:48
  • How about adding collectionView to the view behind vibrancy view and change each cell's zposition to, say, 1.0. While setting vibrancy view's zposition to 0.5. I'm not trying out for myself but would give some random thoughts. – sCha Sep 19 '17 at 14:49
  • I tried modifying the view hierarchy so that I could sit the collectionView on top of the vibrancyView (as opposed to being a child) and anchor the collection view to a subview within the vibrancyView where I want to position it. However, this will not work for some other things I'm doing with this (to explain more: the view containing the labels/collectionView is used as the table header for a tableView, and the tableView is embedded in the vibrancyView...I don't think floating the tableViewCells would be a good idea! But they also have issues with vibrancy so I want it "off" for them too.) – Ethan G Sep 19 '17 at 15:07

0 Answers0