title: How do you make a modal view appear outside of a controller?
body: <p>I am trying to program a little game just to apply the concepts I learned in this course myself. When the game opens up, I would like for a custom modal view to tell the user how to play. Likewise, when they lose, I want to present a results page, which would be inside an if statement. I've searched all over the internet, and I can't find a way to display these views without an error. All that this video shows is how to show a display a view when a button is pressed; how do I display a custom modal view on command in code? (I am very new to Swift, so try to put it in layman's terms.) Thanks!</p>
  
  <pre><code>import UIKit
  var numberValue = 0
  let randomInt = getRandomNumber()
  
  class ViewController: UIViewController {
      @IBOutlet weak var buttonLabel: UILabel!
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
          let vc = self.storyboard?.instantiateViewControllerWithIdentifier("HowToPlayView") as! HowToPlay
  
  self.presentViewController(vc, animated: true, completion: nil)
          // Do any additional setup after loading the view, typically from a nib.
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
  
          // Dispose of any resources that can be recreated.
      }
  
  
  
  
  
      @IBAction func buttonPressed() {
          numberValue += 1
          updateButtonValue(buttonLabel)
      }
  
  
  
  }
  
  
      @IBAction func buttonPressed() {
          numberValue += 1
          updateButtonValue(buttonLabel)
      }
  
  
  
  }
  </code></pre>
  
  <p>That's my view controller. Getting error: Thread 1: EXC_BAD_ACCESS</p>
  
  <p><a href="http://i.stack.imgur.com/YddWp.png" rel="nofollow">My view in interface and connections</a></p>
  
  <p><a href="http://i.stack.imgur.com/NmMoZ.png" rel="nofollow">enter image description here</a></p>