views:

1417

answers:

2

Hi...

I want to change the images depending upon the zoom in or zoom out. Means if i am zoom upto certain limit then it should show other image.

I added one UIImageView in UIScrollView and zoom in and out functionality is working but i am not getting how to change image during zoom in and zoom out.

And while changing image it should have fade effect in between.

Can any one help me for this?

A: 

For animating an image change, you can do:

[UIView beginAnimations:@"imageChange" context:NULL];
yourImageView.image = yourNewImage;
[UIView commitAnimations];

The change will have the fade effect you want.

About the zoom-in and zoom-out functionality I'm not sure, but you should check if the view is zooming (zooming property for your UIScrollView should be true) and then use the zoomScale property. I suppose you could do this with a timer, continuously checking if the view is zooming.

Marco Mustapic
Not working i used timer also
A: 

UIScrollViewDelegate has a method - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale.

In this method you can check the scale and update the UIImageView with the appropriate UIImage.

David Kanarek