Skip to content

Improper layout #30

@thebarndog

Description

@thebarndog

I found a bug where if a view inherits from NibDesignable, layoutSubviews gets called with the original sizes from the nibs but not for subsequent resizes. I noticed it when I was making a circular image view and despite doing self.imageView.layer.cornerRadius = self.imageView.frame.size.width /2 in layoutSubviews, the image was rounded strangely, even when it had a 1:1 aspect ratio using autolayout.

My fix was simply to add self.layoutIfNeeded to awakeFromNib but I suspect the issue goes deeper than that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions