简体   繁体   English

iOS clipsToBounds是和阴影?

[英]iOS clipsToBounds YES and Shadow?

I have a UITableView that is kind of floating, and has rounded corners and a set height. 我有一个浮动的UITableView,并且具有圆角和设置的高度。 But I want to add a shadow too it, but my problem is I need to have clipsToBounds turned on so my cells don't go outside of the floating UITableView. 但是我也想添加阴影,但是我的问题是我需要打开clipsToBounds ,这样我的单元格才不会超出浮动UITableView的范围。

Is there anyway to add a shadow while keeping clipsToBounds turned on for a UITableView? 无论如何,在为UITableView启用clipsToBounds的同时添加阴影?

我建议将UITableView放在相同大小的UIView中,以便您可以在UITableView上保留clipsToBounds ,但给该UIView clipsToBounds阴影以阴影,这样看起来好像UITableView子视图正在投射该阴影。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM