Home > Blockchain >  How can one set constraints to the title text such that it's size is relative to that of the su
How can one set constraints to the title text such that it's size is relative to that of the su

Time:10-14

I need to set constraints on the title text of my application such that the font size of the text is relative to that of the superview. This would help the text to vary with the screen size.

CodePudding user response:

Found how to do so.

So what I did was:

  1. I linked and made a variable for my title text by:
@IBOutlet weak var iXyloTitle: UILabel!
  1. then what I did was, set the size of the title text relative to the superview ie: 0.031 to the size of the superview by:
iXyloTitle.font = iXyloTitle.font.withSize(self.view.frame.height * 0.031) 
  • Related