I have a simple UIView subclass that contains a label. This subclass has the following init method:
override init(frame: CGRect) {
super.init(frame: frame)
self.autoSetDimension(.Height, toSize: 44)
titleLabel.backgroundColor = UIColor.clearColor()
titleLabel.translatesAutoresizingMaskIntoConstraints = false
titleLabel.numberOfLines = 0
self.addSubview(titleLabel)
titleLabel.text = "Some text"
titleLabel.sizeToFit()
titleLabel.autoPinEdgeToSuperviewEdge(.Leading, withInset: 20)
titleLabel.autoPinEdgeToSuperviewEdge(.Trailing, withInset: 20)
titleLabel.autoAlignAxisToSuperviewAxis(.Horizontal)
}
Actually, the text of the label could change at runtime, but anyway, I don't see the label vertically centered within its parent view when I run the app... could somebody help me with this?
Thanks in advance
See this, if it could help you,