Hello,
I have a number of UIButtons moving in an animation where they overlap. Is there a way to programmatically move one button in front of another when passing a given coordinate?
Thanks,
Nick
I have a number of UIButtons moving in an animation where they overlap. Is there a way to programmatically move one button in front of another when passing a given coordinate?
Code:
- (IBAction) onTimer1 {
button1.center = CGPointMake(button1.center.x+pos1.x,button1.center.y+pos1.y);
if (button1.center.x > 270|| button1.center.x+pos1.y < 55)
pos1.x = -pos1.x;
if (button1.center.y > 400|| button1.center.y+pos1.y < 292.5)
pos1.y = -pos1.y;
if (button1.center.y > 395)
button1.transform = CGAffineTransformMakeScale(1, 1);
//Here is where I want to move to front.
if (button1.center.y < 394)
button1.transform = CGAffineTransformMakeScale(.5, .5); //...
//Here is where I want to move to back.
}
Thanks,
Nick