简体   繁体   中英

How can one set constraints to the title text such that it's size is relative to that of the superview using the Storyboard UI in "XCODE"?

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.

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) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM