开发者

Can you animate a UIImage within a scrollview instead of just the screen

开发者 https://www.devze.com 2023-04-07 21:35 出处:网络
In myh App for the iPhone I have a UIScrollView which is twice the height of the actual screen.In the scrollview there is a button which when pressed alternates between the top portion of the scrollvi

In myh App for the iPhone I have a UIScrollView which is twice the height of the actual screen. In the scrollview there is a button which when pressed alternates between the top portion of the scrollview and the bottom (with a nice sliding animation).

In the bottom portion of the ScrollView is a UIImageView which moves from the top of the screen to the bottom of the screen using the built-in animation blocks. Note I said screen which mean开发者_运维知识库s the bottom visible portion of the UIScrollView.

My problem is that when the user presses the button to change view during the UIImageView's animation the image does not stay on the bottom portion of the ScrollView, instead it keeps animating within the visible portion of the screen, which is not showing the top portion of the ScrollView.

Is there a way to specify the UIImageViews animation is within a ScrollView instead of having it be the visible portion of the screen?

I am using the

   UIView animateWithDuration:<#(NSTimeInterval)#> animations:<#^(void)animations#>

code to perform the animation on the UIImageView.


Make the UIImageView a subview of your scroll view.

Set the enabled property of your button to NO during the animation.

0

精彩评论

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