Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abhimuralidharan/52f8e1418f3a4433c4f0eb8792e18689 to your computer and use it in GitHub Desktop.
Save abhimuralidharan/52f8e1418f3a4433c4f0eb8792e18689 to your computer and use it in GitHub Desktop.
class CustomLabel: UILabel {
let edgeInsets: UIEdgeInsets
init(frame: CGRect, insets: UIEdgeInsets) {
edgeInsets = insets
super.init(frame: frame)
}
convenience init(text: String?, dx: CGFloat, dy: CGFloat) {
let insets = UIEdgeInsets(top: dy, left: dx, bottom: dy, right: dx)
self.init(frame: .zero, insets: insets)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment