I'm having a ImageView and a UILabel both aligned Top to Top.
They are next to each other so I have the label and then right of it the textview. Now when there is text in the label the text first letter is lower then the top of the ImageView. I want that the text first letter is always aligned to the top of the ImageView. So now I aligned the text -3 points to the top of the imageView and then it works. But I don't want to work with magic numbers.
This are the constraints I'm using
self.iconImageView.autoSetDimension(.Height, toSize: 10)
self.iconImageView.autoSetDimension(.Width, toSize: 10)
self.iconImageView.autoPinEdge(.Top, toEdge: .Top, ofView:self, withOffset: Constants.kMarginLarge)
self.iconImageView.autoPinEdge(.Left, toEdge: .Left, ofView:self, withOffset: Constants.kMarginNormal)
self.titleLabel.autoPinEdgeToSuperviewEdge(.Bottom, withInset: 5)
self.titleLabel.autoPinEdge(.Top, toEdge: .Top, ofView: self.warningImageView, withOffset: -3)
self.titleLabel.autoPinEdge(.Left, toEdge: .Right, ofView:self.warningImageView, withOffset: 5)
self.titleLabel.autoPinEdge(.Right, toEdge: .Right, ofView:self, withOffset: -5)
Is there any way to calculate the offset and taking into account the First letter or something?
Screenshots: