Skip to content

Conversation

@ryanlietzenmayer
Copy link

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.

DesignableView and DesignableButton both support drop shadows as IBInspectable and available in Interface Builder.
DesignableView and DesignableButton both support drop shadows as IBInspectable and available in Interface Builder.
DesignableView and DesignableButton both support drop shadows as IBInspectable and available in Interface Builder.
 Shadow options for DesignableTextField.swift
 Shadow options for DesignableTextView.swift
@ryanlietzenmayer
Copy link
Author

The DesignableTextField and DesignableImageView changes are working, but I'm having trouble showing shadows with the DesignableTextView.

@ryanlietzenmayer
Copy link
Author

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.

@ryanlietzenmayer
Copy link
Author

ryanlietzenmayer commented Sep 6, 2018

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants