Increase Label Width According To Text

PHOTO EMBED

Tue May 24 2022 10:32:06 GMT+0000 (UTC)

Saved by @hasnat #ios #swift #label #layout #width #labelwidth

    func setBalanceLabel(_ balance: String) {
        let height = balanceLabel.layer.frame.height
        balanceLabel.text = "  " + balance + "  "
        balanceLabel.sizeToFit()
        balanceLabel.layer.frame.size.height = height
        balanceLabel.layer.cornerRadius = balanceLabel.layer.frame.height/2
    }
content_copyCOPY