Animate a UIView out of thin air
Today, I was trying to animate a menu-like view so that it slides out of a bar of buttons at the bottom of my application. Easy enough, I read some documentation about animations here. And I end up with code similar to this in the controller responsible for the sliding view:
1 2 3 4 5 6 7 8 9 10 |
CGRect frame = self.view.frame; // make sure the view initially sits outside the screen frame.origin.y = 480; self.view.frame = frame; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; frame.origin.y = referenceFrame.origin.y - frame.size.height; self.view.frame = frame; [UIView commitAnimations]; |
Nothing spectacular. I […]