Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadow options for DesignableTextView, DesignableTextField, and DesignableImageView #316

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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.

None yet

2 participants