title: Xcode Swift: How to change button font size dynamically according to the size of the button?
body: <p>I know I can chagne the font size of an UIlabel dynamically by using auto-shrink. But there's no auto-shrink property for UIbuttons, </p>
  
  <p>so how can I change the font size of my button dynamically according to the size of my button?</p>
  
  <p>COde:</p>
  
  <p>import UIKit</p>
  
  <p>class ViewController: UITableViewController {</p>
  
  <pre><code>@IBAction func myButt(_ sender: UIButton) {}
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
      myButt.titleLabel?.adjustsFontSizeToFitWidth = true
  
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return 1
  }
  override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "cell")! as UITableViewCell
  
      return cell
  }
  </code></pre>
  
  <p>}</p>