title: How to position one image in front of another?
body: <p>I'm new in Swift development, so I hope you guys can help.</p>
  
  <p>I have a game map, it contains 50 different ImageView (position) from 1 to 50, 4 characters, and a dice roll(button).
  When I press i dice roll button it returns a random number between 1 to 6.</p>
  
  <p>For example: I pressed dice roll button and it returned 4, so now i want to move my character to new position(to ImageView place4).</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var girl: UIImageView!
  var place4 = UIImageView(image: UIImage(named: "4.png"))
  
  girl.frame = CGRect(x: 200, y: 200, width: 45, height: 100) 
  scrollView.addSubview(girl)
  
  place4.frame = CGRect(x: 210, y: 145, width: 60, height: 30)
  scrollView.addSubview(place4)
  
  func moveCharacter(sender:UIButton!) {
  let duration = 1.0
      let delay = 0.0 // delay will be 0.0 seconds (e.g. nothing)
      let options = UIViewAnimationOptions.CurveEaseInOut // change the timing curve to `ease-in ease-out`
  
      UIView.animateWithDuration(duration, delay: delay, options: options, animations: {
          // any changes entered in this block will be animated
          self.girl.center = CGPointMake(self.place4.center.x, self.place4.center.y - 30)
  
          }, completion: { finished in
              // any code entered here will be applied
              // once the animation has completed
  
              //self.place4.hidden = true
  
      })
  }
  </code></pre>
  
  <p>When I press button, UIImageView "girl" should move to X and Y coordinate of UIImageView "place4". To move character to new position I use following code:</p>
  
  <pre><code>self.girl.center = CGPointMake(self.place4.center.x, self.place4.center.y - 30)
  </code></pre>
  
  <p>and girl image should appear over place4 image, but actually girl image appear behind place4 image, pls look at the screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/LQu9c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LQu9c.png" alt="enter image description here"></a></p>
  
  <p>But actually what i try to achieve is this: </p>
  
  <p><a href="https://i.stack.imgur.com/wCZ4L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wCZ4L.png" alt="enter image description here"></a></p>
  
  <p>I tried to use UiView methods bringSubviewToFront and sendSubviewToBack, but it did'n help.</p>
  
  <p>How can I fix this issue? Or maybe you guys can advise me better solution?</p>
  
  <p>Thanks to all in advance.</p>