0

I have designed popup view using UIStackView. I'm trying to shadow to "Alert View" as showing in the picture. Parameters for shadow are shown at the right side.

Storyboard design

But it is not showing shadow after I run code.

After running on device

But if I design this popup without UIStackView, it shows up the shadow.

What is reason behind this?

Pramod More
  • 1,220
  • 2
  • 22
  • 51

1 Answers1

0

Your AlertView has clipToBounds ticked. Thats the reason why you dont see shadow added to AlertView. Uncheck it to work properly

O/P with clipToBounds ticked

enter image description here

enter image description here

**O/P after unchecking ClipToBounds **

enter image description here enter image description here

EDIT:

Though am not sure, the IBInspectable you set up for properties like Shadow Radius might not be set up correctly, please try setting shadow programmatically

    self.alertView.layer.shadowRadius = 3
    self.alertView.layer.shadowOffset = CGSize(width: 2, height: 4)
    self.alertView.layer.shadowOpacity = 2
    self.alertView.layer.shadowColor = UIColor.black.cgColor

If this works then you can solve the issue with IBInspectables of yours

Sandeep Bhandari
  • 19,999
  • 5
  • 45
  • 78