I want to show part of an image in animation.I put a UIImageView
in the UIScrollView
,and set the UIImageView's frame to (0, 0, imageWidth, imageHeight)
,and set UIScrollView's frame's width to 0
. Here is my code
self.tiaoView.contentSize=CGSizeMake(316, 74);//tiaoView is an outlet of UIScrollView
[UIView animateWithDuration:5 animations:^{
CGRect rect=self.tiaoView.frame;
rect.size.width=316;
self.tiaoView.frame=rect;}];
But when I run it, the whole image is showed immediately, no animation.