Animate a UIView out of thin air

By | September 15, 2012

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:

Nothing spectacular. I make sure the initial view in outside the visible part of the screen and I animate the view into its final position.

Now my view slides up but in my case the final position is on top of another view. So there is content below its final position. My sliding menu ends up sliding up in front of the button bar and all. Not so nice but the solution is simple right ? just animate the height of the view as well. It will appear to slide out of the whichever view you selected as a reference view.

Well not so fast !! my view has kept its initial size. I had to search for a while. My view was not resizing because of its content. In the end, I had to change my views property so that it ‘Clips Subviews’

TiMoch on edge

Leave a Reply