0

I have 2 ImageView in subview(UIView). I set zoom scale for foreground image by 0.3 point.

self.superImage_View.transform =CGAffineTransformMakeScale(1.3,1.3);

after that when i click on resize button i again change zoom scale of foreground image.

self.superImage_View.transform =CGAffineTransformMakeScale(1.0,1.0);

I also want to change zoom scale of background image by 0.3 point. I set pinch gesture on background image for zoom in/out.But the problem is i am unable to find out the scale of background imageview. Also if background imageview is zoom in/out by user after that on the click of resize button i am unable to decrease zoom by 0.3 scale point. I want same zoom decrease scale for both image doesn't matter the background imageview is zoom in/out or not. Please provide me any solution.

Mitesh Dobareeya
  • 970
  • 1
  • 11
  • 36
  • 1
    check it [http://stackoverflow.com/questions/8891356/uiimageview-and-uiscrollview-zooming](http://stackoverflow.com/questions/8891356/uiimageview-and-uiscrollview-zooming) – sumit rathore Apr 23 '16 at 06:20
  • Yes this is right but what i have to do ?on Resize button click? i have to decrease both image scale by 0.3 scale point. i.e in short when view appear i show foreground image with zoom and on resize button click i decrease zoom by fix point. The same thing i want for background but problem is if after zoom in/out on background i am unable to get scale point,so by using that scale point i can again decrease size by fix point on resize button click . – Mitesh Dobareeya Apr 23 '16 at 06:42

1 Answers1

0

Two things. You need to add UIImageView inside UIScrollView.

Zooming only works when you implement the viewForZoomingInScrollView: delegate callback.

  -(UIView *) viewForZoomingInScrollView:(UIScrollView *)inScroll {
      return imageView;
    }

You can add imageView inside scrollView with zooming scale like this:

  UIImageView *tempImage = [[UIImageView alloc]initWithImage:[UIImage imageWithData:data]];
  self.imageView = tempImage;

  scrollView.contentSize = imageView.frame.size;
  scrollView.maximumZoomScale = yourMaximumScale;
  scrollView.minimumZoomScale = yourMinimumScale;
  scrollView.clipsToBounds = YES;
  scrollView.delegate = self;
  [scrollView addSubview:imageView];
  scrollView.zoomScale = yourScale;
rolling_codes
  • 15,174
  • 22
  • 76
  • 112
Akash KR
  • 778
  • 3
  • 11