title: How to set the Title Padding (Inset) for UIButton in Swift
body: <p>I'm a beginner iOS programmer and try to develop an iOS application. I have several buttons that I put on the home page of the app like in the picture.</p>
  
  <p><a href="https://i.stack.imgur.com/b9TDl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/b9TDl.png" alt="Front Page"></a></p>
  
  <p>please look at the red circle. There's no space (padding/insets) between the image and the title. </p>
  
  <p>actually, I already set the image and title insets using this code. But, it did not give any different result.</p>
  
  <pre><code>    buttonDoctor.titleLabel?.numberOfLines = 2
      buttonDoctor.titleLabel?.lineBreakMode = .byWordWrapping
      buttonMedical.titleLabel?.numberOfLines = 2
      buttonMedical.titleLabel?.lineBreakMode = .byWordWrapping
      buttonQuestion.titleLabel?.numberOfLines = 2
      buttonQuestion.titleLabel?.lineBreakMode = .byWordWrapping
      buttonLocation.titleLabel?.numberOfLines = 2
      buttonLocation.titleLabel?.lineBreakMode = .byWordWrapping
      buttonPromotion.titleLabel?.numberOfLines = 2
      buttonPromotion.titleLabel?.lineBreakMode = .byWordWrapping
      buttonDoctor.image(for: .normal)
      buttonMedical.image(for: .normal)
      buttonQuestion.image(for: .normal)
      buttonLocation.image(for: .normal)
      buttonPromotion.image(for: .normal)
      //buttonDoctor.titleLabel?.adjustsFontSizeToFitWidth = true
      //buttonPromotion.titleLabel?.adjustsFontSizeToFitWidth = true
      //buttonLocation.titleLabel?.adjustsFontSizeToFitWidth = true
      //buttonQuestion.titleLabel?.adjustsFontSizeToFitWidth = true
      //buttonMedical.titleLabel?.adjustsFontSizeToFitWidth = true
  
  
  
      let btnimg = try? UIImage(named: "doctorschedule.png")
      var newimg = imageResize(image: btnimg!!, scaledTo: CGSize(width: 36, height: 36))
      buttonDoctor.setImage(newimg, for: .normal)
      buttonDoctor.contentMode = .scaleAspectFit
      buttonDoctor.imageEdgeInsets = UIEdgeInsetsMake(5, 3, 0, 5)
      buttonDoctor.titleEdgeInsets = UIEdgeInsetsMake(5, 3, 0, 0)
  
      let btnimg2 = try? UIImage(named: "medicalcheck.png")
      var newimg2 = imageResize(image: btnimg2!!, scaledTo: CGSize(width: 36, height: 36))
      buttonMedical.setImage(newimg2, for: .normal)
      buttonMedical.contentMode = .scaleAspectFit
      buttonMedical.imageEdgeInsets = UIEdgeInsetsMake(5, 3, 0, 5)
      buttonMedical.titleEdgeInsets = UIEdgeInsetsMake(5, 3, 0, 0)
  
      let btnimg3 = try? UIImage(named: "survey.png")
      var newimg3 = imageResize(image: btnimg3!!, scaledTo: CGSize(width: 36, height: 36))
      buttonQuestion.setImage(newimg3, for: .normal)
      buttonQuestion.contentMode = .scaleAspectFit
      buttonQuestion.imageEdgeInsets = UIEdgeInsetsMake(5, 3, 0, 5)
      buttonQuestion.titleEdgeInsets = UIEdgeInsetsMake(5, 3, 0, 0)
  
      let btnimg4 = try? UIImage(named: "location.png")
      var newimg4 = imageResize(image: btnimg4!!, scaledTo: CGSize(width: 36, height: 36))
      buttonLocation.setImage(newimg4, for: .normal)
      buttonLocation.contentMode = .scaleAspectFit
      buttonLocation.imageEdgeInsets = UIEdgeInsetsMake(5, 3, 0, 5)
      buttonLocation.titleEdgeInsets = UIEdgeInsetsMake(5, 3, 0, 0)
  
      let btnimg5 = try? UIImage(named: "promotion.png")
      var newimg5 = imageResize(image: btnimg5!!, scaledTo: CGSize(width: 36, height: 36))
      buttonPromotion.setImage(newimg5, for: .normal)
      buttonPromotion.contentMode = .scaleAspectFit
      buttonPromotion.imageEdgeInsets = UIEdgeInsetsMake(5, 3, 0, 5)
      buttonPromotion.titleEdgeInsets = UIEdgeInsetsMake(5, 3, 0, 0)
  </code></pre>
  
  <p>I already tried several value for the insets, but it give no different result. did I do anything wrong with my code?</p>
  
  <p>please some one kindly help me how to solve this problem. thank you</p>
  
  <p>Note: I have one more concern. I want to put an image logo at the top of the front page (see the orange circle), but I don't know how to do it. Since there's no property to insert an image in the navigation bar. 
  FYI, it's just regular navigation bar inside the <code>UIViewController</code> that I put from the storyboard (not <code>UINavigationController</code>). If you don't mind, please give some advice about this. </p>
  
  <p>NOTE : Everything in the circle is just a regular UIBUTTON not UIImage and UILabel or UIbutton. Please see my code.</p>