Created
December 10, 2018 05:19
-
-
Save fieldAbyss/9efea7e116be7d490b9fbcf1e73c9b2e to your computer and use it in GitHub Desktop.
'UIEdgeInsetsInsetRect' has been replaced by instance method 'CGRect.inset(by:)'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IndentedLabel: UILabel { | |
override func drawText(in rect: CGRect) { | |
let insets = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 0) | |
// let customRect = UIEdgeInsetsInsetRect(rect, insets) Swift 4.0 | |
// Swift 4.2~ | |
let customRect = rect.inset(by: insets) | |
super.drawText(in: customRect) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment