I added autoLayout in storyBoard (w: Any, h: Any)
But because of fixed font size, The font size is same in all of devices (4, 4.7, 5.5 inch)
It looks nice i
Check the screen size and manipulate the font size based on it:
let screenSize = UIScreen.mainScreen().bounds.size
if screenSize.height < 568 {
//Set font size for 4
} else if screenSize.height < 568 {
//Set font size for 5
} else if screenSize.height < 568 {
//Set font size for 6
} else {
//Set font size for 6+
}
UPDATE:
Extend the UILabel class to setup your label:
extension UILabel {
func setupLabelDynamicSize(size size:CGFloat) {
let screenSize = UIScreen.mainScreen().bounds.size
if screenSize.height < 568 {
//Set self.font equal size
} else if screenSize.height < 568 {
//Set self.font equal size + 1
} else if screenSize.height < 568 {
//Set self.font equal size + 2
} else {
//Set self.font equal size + 3
}
}
}
then wherever you have a label that you want with dynamic size just call:
labelObject.setupLabelForDynamicSize(size: 14)