Open ryanlietzenmayer opened 6 years ago
The DesignableTextField and DesignableImageView changes are working, but I'm having trouble showing shadows with the DesignableTextView.
With this change, DesignableTextView will only show shadows if clipsToBounds
is set to false
at or after viewDidLoad
. It doesn't matter if it's unchecked and set to false for the view in Interface Builder.
I don't know where it's getting set to true.
@IBInspectable public var shadowOpacity: CGFloat = 0 {
didSet {
layer.shadowOpacity = Float(shadowOpacity)
clipsToBounds = false
}
}
Adding clipsToBounds here makes shadows show in-app, but prevents the Clips to Bounds checkbox in Interface Builder from cutting off shadows like it does by default. Definitely not a graceful solution.
Note, setting clipsToBounds
from a View Controller still works as it does by default.
These options were present for DesignableView and DesignableButton, but not DesignableTextView, DesignableTextField, and DesignableImageView. I do not know if this is an intentional choice, but this is an inconsistency.
I updated DesignableTextView, DesignableTextField, and DesignableImageView to match shadow options on existing views.