title: Change z index of objects programmatically
body: <p>I am developing this application where the z there are two buttons above each other. when clicking one of them the other should be visible and clickable.</p>
  
  <p>I first thought about changing the z index by setting:</p>
  
  <p>self.buttonOne.layer.zPosition=50;
  self.buttonTwo.layer.zPosition=100;</p>
  
  <p>So their they would flip and then the other button would be viewable and clickable. </p>
  
  <p>What actually happened is that it became viewable but not clickable. When I press the button nothing happens. </p>
  
  <p>I tried this method in different forms, I tried it on table views and cells and this was the same behavior. </p>
  
  <p>How can I change the z index in a appropriate way?</p>