title: Vertically align text within a UILabel (xcode)
body: <p>Long time reader, first time poster. I have searched all over for a solution but I am yet to find an answer that works.</p>
  
  <p>Ok the problem: I have a UILabel which gets text dynamically assigned to it. If I resize the label to cover the entire view controller the text is stuck in the middle. I found a bunch of solutions which say to add the following code:</p>
  
  <pre><code>detailsLabel.numberOfLines = 0;
  detailsLabel.sizeToFit()
  </code></pre>
  
  <p>However this doesn't do anything.</p>
  
  <p>Can someone have a look at my code and provide suggestions?</p>
  
  <pre><code>import UIKit
  
  class DetailsViewController: UIViewController {
  
  @IBOutlet weak var detailsLabel: UILabel!
  @IBOutlet weak var lbldetails: UILabel!
  
  
  var selectedBeach : Beach?
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Do any additional setup after loading the view.
      detailsLabel.text = selectedBeach?.greaterDetails
      lbldetails.text = (selectedBeach?.beachName ?? "") + " Details"
  
      detailsLabel.numberOfLines = 0;
      [detailsLabel .sizeToFit()]
  
  }
  
  @IBAction func dismiss(sender: AnyObject) {
      self.dismissViewControllerAnimated(true, completion: nil)
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  
  /*
  // MARK: - Navigation
  
  // In a storyboard-based application, you will often want to do a little preparation before navigation
  override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
      // Get the new view controller using segue.destinationViewController.
      // Pass the selected object to the new view controller.
  }
  */
  </code></pre>