开发者

Can you set different CALayer border width on different side?

开发者 https://www.devze.com 2023-04-01 17:18 出处:网络
I am trying to create a pseudo-3D square (like a scrabble tile) and I was thinking of faking it with borders. But then I couldn\'t find a way to set different width for different side.

I am trying to create a pseudo-3D square (like a scrabble tile) and I was thinking of faking it with borders. But then I couldn't find a way to set different width for different side.

Is this possible at all? If not, does anyone have any recommendation on how to do this in CALayer?

Oh, one caveat, I am already using shadow, so can't use tha开发者_开发问答t to fake the bevel.


Not possible with ordinary CALayer properties. You'd have to inset your layer and draw the different borders in the drawing method, or add a second larger layer to take care of that inside its drawing.


You could possibly do it with the layer's shadow properties, using -shadowOffset to only render it on two sides. However, to make it really nice you probably have to draw it yourself.

0

精彩评论

暂无评论...
验证码 换一张
取 消