title: Override font size for 3.5 inch iOS devices
body: <p>I'm subclassing <code>UILabel</code> and <code>UITextField</code> in order to change the font size on just 3.5 inch devices (as this can't be done using size classes independently of 4 and 4.7 inch devices).</p>
  
  <p>The font changes if it's done in <code>layoutSubviews()</code> but it's repeatedly called so the font size ends up at zero. I'm trying to find another place to set it that is only called once and still can override the font size.</p>
  
  <p>Code:</p>
  
  <pre><code>if (UIDevice.currentDevice().orientation == .Portrait) {
      if (UIScreen.mainScreen().bounds.size.height &lt; 568) {
          self.font = UIFont(name: "Score Board", size: (self.font.pointSize - CGFloat(10.0)))
      } else {
          self.font = UIFont(name: "Score Board", size: self.font.pointSize)
      }
  } else {
      if (UIScreen.mainScreen().bounds.size.width &lt; 568) {
          self.font = UIFont(name: "Score Board", size: (self.font.pointSize - CGFloat(10.0)))
      } else {
          self.font = UIFont(name: "Score Board", size: self.font.pointSize)
      }
  }
  </code></pre>
  
  <p>I've also tried it in <code>didMoveToSuperview()</code> and <code>willMovetoSuperview()</code>, it was only called once but it didn't actually change the fonts. I've also tried it in <code>init</code> but again the font isn't set.</p>
  
  <pre><code>import Foundation
  import UIKit
  
  class CustomUILabel : UILabel {
  
      override func didMoveToSuperview() {
          super.didMoveToSuperview()
          // Code from above
      }
  }
  </code></pre>