Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Some pixels between the text and the border in a ui.Label?
-
How to code this in Python using Objective-C?
class CustomLabel: UILabel { var padding:UIEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0) required init(frame: CGRect, padding: UIEdgeInsets) { super.init(frame: frame) self.padding = padding } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func drawText(in rect: CGRect) { let changedRect: CGRect = CGRect(x: (rect.origin.x + padding.left), y: (rect.origin.y + padding.top), width: (rect.size.width - (padding.left + padding.right)), height: (rect.size.height - (padding.top + padding.bottom))) super.drawText(in: changedRect) } } Implement it in the following way. let label:CustomLabel = CustomLabel(frame: CGRect(x: 0, y: 20, width: self.view.frame.size.width, height: 60), padding: UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20))