title: How can I apply a font to a button when the button style is "Filled"?
body: <p>The target I want to achieve is a radiobutton with</p>
  <ul>
  <li>a filled frame,</li>
  <li>a padding between text and image</li>
  <li>and a specific font for the text.</li>
  </ul>
  <p>My problem is that I cannot get all 3 conditions successfully combined. Which of the intended attributes are realized by the system depends on the setting of the Style attribute in the IB for the particular button. I have made the changes for padding and font in the program code also but experienced that they are overruled from the button attributes in the IB:</p>
  <ul>
  <li>When the Style attribute is &quot;Default&quot;, a required font can be applied successfully. (Regardless whether via program code or in the IB). But then padding does not work.</li>
  <li>When the Style attribute is &quot;Filled&quot;, paddings and frame parameters will work but the font is not applied.</li>
  </ul>
  <p>Here a simplified example in which I want the Courier New font to be applied. I have two Radiobuttons defined to demonstrate the impact of the Style attribute. At first the version with &quot;Default&quot;. We see that the text is Courier. But there is not frame and padding. Also if padding would be set programmatically, it is ignored by the system.</p>
  <p><a href="https://i.stack.imgur.com/DvqEe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DvqEe.png" alt="enter image description here" /></a></p>
  <p>Next the version with &quot;Filled&quot;. The font setting is ignored by the system. This is my problem:
  <a href="https://i.stack.imgur.com/SmoIp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SmoIp.png" alt="enter image description here" /></a></p>
  <p>Is there a way to get frame, font and padding be combined? Any advice would be appreciated. For reference here the piece of code in which I made the setting as well. I had written a class RadioButton in which the images, the font and the padding should be applied.</p>
  <pre><code>class RadioButton: UIButton {
  // Images
  let checkedImage = UIImage(named: &quot;radioButtonSet_25&quot;)! as UIImage
  let uncheckedImage = UIImage(named: &quot;radioButtonNotSet_25&quot;)! as UIImage
  
  // Bool property
  var isChecked: Bool = false {
      didSet {
          self.titleLabel?.font = UIFont(name: &quot;CourierNewPSMT&quot;, size: 
  CGFloat(15))
          self.configuration?.imagePadding = (50 as CGFloat)
          if isChecked == true {
              self.setImage(checkedImage, for: UIControl.State.normal)
          } else {
              self.setImage(uncheckedImage, for: UIControl.State.normal)
          }
      }
    }
  }
  </code></pre>