0

Text inside the label is aligned centered horizontally as well as vertically. How do I set the text to align below the mid horizontal axis?

Anuranjan Bose
  • 141
  • 1
  • 15

2 Answers2

1

You can do this by subclassing UILabel and override this method

- (void)drawTextInRect:(CGRect)rect {
  UIEdgeInsets insets = {6, 5, 0, 5};//{top, left,bottom,right} Change the padding values as your need
 [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
}
lazyTank
  • 1,343
  • 1
  • 7
  • 11
0

There are many ways to do it. But this is the simplest one.

Create a UIView

Add that Label into that view

Add auto layout constraint to define fixed margin from the bottom of the view.

Ankit Saxena
  • 799
  • 6
  • 10