iOS clipsToBounds YES和Shadow? [英] iOS clipsToBounds YES and Shadow?

查看:317
本文介绍了iOS clipsToBounds YES和Shadow?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个漂浮的UITableView,有圆角和设定高度。但是我想添加一个阴影,但我的问题是我需要打开 clipsToBounds ,这样我的单元格就不会出现浮动的UITableView。

I have a UITableView that is kind of floating, and has rounded corners and a set height. 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.

在为UITableView保持clipsToBounds开启时是否有添加阴影?

Is there anyway to add a shadow while keeping clipsToBounds turned on for a UITableView?

推荐答案

我建议将 UITableView 放在相同大小的 UIView 中,这样你就可以维持 clipsToBounds UITableView 上但是给那个 UIView superview阴影所以它看起来好像 UITableView 子视图正在投射阴影。

I'd recommend putting the UITableView within a UIView of the same size so you can maintain clipsToBounds on the UITableView but give that UIView superview the shadow so it looks as if the UITableView subview is casting that shadow.

这篇关于iOS clipsToBounds YES和Shadow?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆