Skip to content
This repository was archived by the owner on Feb 17, 2021. It is now read-only.
This repository was archived by the owner on Feb 17, 2021. It is now read-only.

Blurry UILabel #196

Description

@moshegutman

When using a UILabel and the alignment frame isn't placed on an integer value, the text can appear blurry.

I solved this by adjusting the return CGRect inside the Alignment constructor. I added a call to .integral

public init(vertical: Vertical, horizontal: Horizontal) {
        self.aligner = { (size: CGSize, rect: CGRect) -> CGRect in
            let (x, width) = horizontal.align(length: size.width, availableLength: rect.width, offset: rect.origin.x)
            let (y, height) = vertical.align(length: size.height, availableLength: rect.height, offset: rect.origin.y)
            return CGRect(x: x, y: y, width: width, height: height).integral
        }
    }

Not sure if this should be classified as a bug

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions