开发者

How do you create an animation like the iBooks app's moving bookmark?

开发者 https://www.devze.com 2023-01-17 03:05 出处:网络
When you tap the bookmark, it slides down or up smoothly. As it slides up, it disappears as if behind the view directly above it. I know how to animate changing the frame of a view, but I don\'t know

When you tap the bookmark, it slides down or up smoothly. As it slides up, it disappears as if behind the view directly above it. I know how to animate changing the frame of a view, but I don't know how to make it disappear like that. (I don't want to resize the UIImage, just slid开发者_运维问答e the UIImageView up and out of sight.)

I figure I need an invisible button to toggle the animation, and an UIImageView to animate. Do I need to change the bounds of the UIImageView, or should I use the frame? I thought I could just change the height from X to 0, but it didn't seem to resize the UIImageView. I had a little luck with settings the bounds with clipping subview's enabled, but I wasn't quite there.

I don't think I understand the relationship between the bounds and the frame.


I ended up adding a parent UIView to contain the UIImageView. It has the dimensions in which I want the UIImageView to be viewable in, and then I just animate the frame so the Y dimension is equal to the negative height and it slides up nicely.

I was on the wrong track with the bounds.

0

精彩评论

暂无评论...
验证码 换一张
取 消