title: Swift 2 - for loop create multiple UIButtons
body: <p>I have a for loop that creates multiple buttons depending how may users are registered. </p>
  
  <p>The buttons create fine, I have added a target to the button that needs to print which button has been pressed passing a value.</p>
  
  <p>so far I have:</p>
  
  <pre><code>func loadUserVideos() {
  
          let userVideoNames = ["andrew", "john", "verya", "patry", "gabriy"]
  
          let countUserNames = userVideoNames.count - 1
  
          for index in 0...countUserNames {
  
              //print("\(index) times 5 is \(index * 5)")
  
              //UIBUTTON PLAY VIDEO USER
              let customButtonPlayVideoUser = UIButton(frame: CGRectMake(145, 32, 64, 64))
              let imageCustomUserBtn = UIImage(named: "video-play.png") as UIImage?
              customButtonPlayVideoUser.setImage(imageCustomUserBtn, forState: .Normal)
              customButtonPlayVideoUser.addTarget(self, action: "CustomUserVideobtnTouched:", forControlEvents:.TouchUpInside)
              customViewUser.addSubview(customButtonPlayVideoUser)
  
  
          }
  
      }
  
      func CustomUserVideobtnTouched(sender: UIButton, index: Int){
  
          print(index)
      }
  </code></pre>
  
  <p>How can I pass the value to the action function so the app can see which button has been pressed?</p>