0
votes

I have a VC that has a UITableView all over the screen, except the first 66px from the top. There, I have a custom UIView I call "Toolbar" which contains a title and a button.

It looks like this:

Image 1

I'm trying to add a shadow to the "Toolbar" that will be visible on top of the UITableView. I'm adding it like this:

Image 2

For some reason, I don't see any shadow when I run the app.

What am I doing wrong? Does anybody know?

Thank you!

1
are you setting cliptobounds?k-thorat
@kthorat clipToBounds is set to falseFS.O6

1 Answers

1
votes

Shadow needs some spaces to be shown, you have to add some vertical spaces between your top view(toolbar) and the Table view.

for having a result like the following: enter image description here

you need to add some space: enter image description here

ans I also use the following code for adding the shadow:

toolbar.layer.shadowColor = UIColor.black.cgColor
toolbar.layer.shadowOpacity = 1
toolbar.layer.shadowOffset = CGSize.zero
toolbar.layer.shadowRadius = 10
toolbar.layer.masksToBounds = false