开发者

How to add bottom shadow to table cell with dynamic height?

开发者 https://www.devze.com 2023-03-06 11:40 出处:网络
I am about to implement bottom shadow for table cells. However my table cells have dynamic heights and each cell can be toggled to expand or shrink. I would like to have the bottom sha开发者_开发问答d

I am about to implement bottom shadow for table cells. However my table cells have dynamic heights and each cell can be toggled to expand or shrink. I would like to have the bottom sha开发者_开发问答dow anchored to the bottom of each cell.

My question is, if I generate the shadow using BPath in CALayer, how can I anchor the layer to the bottom of a view?


If you are using iOS 3.2 or later, you can use the shadow-specific properties in CALayer - shadowColor, shadowOffset, shadowOpacity, shadowPath and shadowRadius.

[cell.layer setShadowOpacity:0.4];

You will have to manually adjust the shadow layer pre-iOS 3.2 and there is no automatic way in iOS to anchor it to the bottom. What you were looking for was CAConstraintLayoutManager which is available in OSX but not in iOS.

0

精彩评论

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

关注公众号