0
votes

i am newbie in iOS Development i want an image gallery with UIScrollview and i want to Zoom an image when Zoom Button Was pressed initial my Scrollview Size like as

self.zoomScroll.frame=CGRectMake(10, 45, 300, 270);

and i add a Zoom Button in a My View When it is Pressed i set Scrollview Size as

self.zoomScroll.frame=CGRectMake(10, 40, 300, 400);

then scrollview is Shown in new Size but the image inside the Scrollview is in initialSize means image not take a new Size. and my image view Size is like as

bigImage.bounds=CGRectMake(0, 0, self.zoomScroll.frame.size.width +10.0f, self.zoomScroll.frame.size.height);
bigImage.frame=CGRectMake(index * self.zoomScroll.frame.size.width, 0, self.zoomScroll.frame.size.width, self.zoomScroll.frame.size.height);

and here my imageview is not a globally declared it is locally declare so i am not able to use scrollviewZoom method please give me solution for Zoom an image when Zoom button pressed.

1
are you trying to zoom the Image??Saurabh Prajapati
Are you also setting the size of the imageView after changing the size of the scroll view? since you are calculating the size of the imageView from the scrollView, if you set the size of the image view after setting size of the scroll view, it should be updated.Antenehs
i want a zoom to image when zoom button was pressed #Saurabh PrajapatiAshish Gabani
#Antenehs i declare imageview not globally so i not able to change the size of Imageview when zoom button pressedAshish Gabani

1 Answers

1
votes

Please check if this is useful for you, as for my app requirement I am using this.

First thing if you are adding imageViews into scrollView, then before adding each imageView into scrollView set the value for tag property of each imageView it is ok if you set same value for tag property of all the imageViews you are going to add in scrollView.

Then add UIScrollView's delegate method as follows and check,

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView 
{
    return [scrollView viewWithTag:<valueOfTagPropertySetToImageView>];
}