Search code examples
iosuiviewcore-animation

minimize window animation, but for iOS?


I have an overlay help text in a UIView that I would like to animate up to a button in the navigationbar, in a way similar to the minimize window animation on Mac OS X.

I can do the basic animations of fading opacity and resizing windows, but this one is difficult.

Any clues how to do this kind of animation with a UIView?


Solution

  • There are two effects for OSX that you can set for that (if I'm understanding this right), the Scale and Genie effects. To mimic the scale one, you need to animate the scale, opacity, and positions.

    Example using implicit animation:

    view.layer.transform = CATransform3DMakeScale(0.2, 0.2, 1);
    view.layer.position = CGPointMake(yournavbarspot.x, yournavbarspot.y);
    view.layer.opacity = 0.0f;
    

    To do the genie effect, you'd do the same thing and also alter the shape of the view as it animates. I'm not sure if you can change the geometry of a UIView, so the closest thing I can think of would be to create a mask that you alter the geometry of using UIBezierPaths.