Re: Layers and shadows. Is it possible to have a layer with a shadow and no background color?


Alex Zavatone
 

But it’s odd, since I set the shadow opacity to 1, which is 100%. Adding multiple shadows to a UIView is a royal PITA without a CGFilter since you can’t make an empty layer and apply a shadow to it. There isn’t a way that lets you tell Cocoa to “just apply this shadow at the settings I asked for at the alpha level i asked for to the rect I asked you to apply it to."

On Jun 24, 2021, at 6:08 AM, Jeremy Hughes via groups.io <moon.rabbit@...> wrote:

That’s what I would have expected: a transparent object produces no shadow, while a semi-transparent object produces a weak shadow.

It’s analogous to real-life objects.

Jeremy



On 24 Jun 2021, at 00:59, Alex Zavatone via groups.io <zav@...> wrote:

Well, it was worth a shot. The shadow is barely visible even if I use a shadowOpacity of 1.



On Jun 23, 2021, at 6:47 PM, Steve Mills via groups.io <sjmills@...> wrote:

On Jun 23, 2021, at 12:42, Alex Zavatone via groups.io <zav@...> wrote:

What I’ve been doing is duplicating the layer, a task unto itself, adding the layer on top of or behind the previous layer and then getting a shadow that way. It’s not perfect but it’s currently the least bad approach I’ve been able to find.

Our graphic designers will detect a .01 shade change.


What about using black or white at a very low alpha, like .01%?
I said .01%, not 1%. I doubt the naked eye will detect that little of a change.

Steve via iPad











Join {cocoa@apple-dev.groups.io to automatically receive all group messages.