1

I have an overlayimage in my cameraoverlay. I need to zoom in/out when user double touches my overlayimage.

Code for overlayimage:

UIImageView *overlayImageView = [[UIImageView alloc] 
initWithImage:[UIImage imageNamed:@"overlay.png"]];
[overlayImageView setFrame:CGRectMake(30, 100, 260, 200)];
[[self view] addSubview:overlayImageView];
[overlayImageView release];
Michael Celey
  • 12,645
  • 6
  • 57
  • 62
Ram
  • 1,687
  • 3
  • 18
  • 28

1 Answers1

2
- (void)viewDidLoad {
    [super viewDidLoad];

    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
    tapGesture.numberOfTapsRequired = 2;
    [overlayImageView addGestureRecognizer:tapGesture]; // add tapGesture to your ImageView
    [tapGesture release];

  self.isTouch == YES; // it is BOOL type.
}

 - (void)handleTapGesture:(UITapGestureRecognizer *)sender 
{
        if(self.isTouch)
        {
              // put relavent size of Zoom ImageView
            self.isTouch == NO;
        }
        else
        {
              // put code for normal ImageView
              self.isTouch == YES;
        }
}
rene
  • 41,474
  • 78
  • 114
  • 152
iPatel
  • 46,010
  • 16
  • 115
  • 137
  • @karthi-http://stackoverflow.com/questions/500027/how-to-zoom-in-out-an-uiimage-object-when-user-pinches-screen and http://stackoverflow.com/questions/500027/how-to-zoom-in-out-an-uiimage-object-when-user-pinches-screen – iPatel Mar 21 '13 at 11:56
  • @karthi-http://stackoverflow.com/questions/3339084/how-do-i-resize-a-picture-using-uiimageview-so-that-i-can-zoom-in-and-out – iPatel Mar 21 '13 at 12:07