title: Trying to make an Array of image and pass the image to UIImageView
body: <p>I'm trying to put my images into <code>var picture</code> which I declare as  <code>[UIImage]</code>. But I kept finding error ... ?</p>
  
  <p>I'm new to programming . </p>
  
  <p>This is my code:</p>
  
  <pre><code>import UIKit
  import AVFoundation
  
  class ViewController: UIViewController {
  
  
  
  @IBOutlet weak var nameLabel: UILabel!
  @IBOutlet weak var imageView: UIImageView!
  @IBAction func playButton(sender: AnyObject) {
  
  }
  
  @IBAction func stopButton(sender: AnyObject) {
      player.stop()
  
  }
  var player:AVAudioPlayer = AVAudioPlayer()
  
  var files = ["song1", "song2","song3","song4","song5","song6","song7"]
  
  var name:String = ""
  
  var picture:[UIImage] = [
      UIImage(named: "pic/1.jpg")!,
      UIImage(named: "pic/2.jpg")!,
      UIImage(named: "pic/3.jpg")!,
      UIImage(named: "pic/4.jpg")!,
      UIImage(named: "pic/5.jpg")!,
      UIImage(named: "pic/6.jpg")!,
      UIImage(named: "pic/7.jpg")!,
      UIImage(named: "pic/8.jpg")!,    ]
  
  
  var condition:Bool = false
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
  
  
  
  }
  
  override func motionEnded(motion: UIEventSubtype, withEvent event: UIEvent!) {
  
      if event.subtype == UIEventSubtype.MotionShake {
  
  
  
  
  
          var randomNumber = Int(arc4random_uniform(UInt32(files.count)))
  
  
          var fileLocation = NSString(string:NSBundle.mainBundle().pathForResource("sounds/" + files[randomNumber], ofType: "mp3")!)
  
  
          var error:NSError? = nil
          player = AVAudioPlayer(contentsOfURL: NSURL(string: fileLocation), error: &amp;error)
  
          player.play()
  
          var i = randomNumber
  
         var image = picture[randomNumber]
  
          imageView.image = image
  
          name = files[randomNumber]
          nameLabel.text = name
  
          }
  
  
  
  
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  } 
  </code></pre>