我的相机覆盖中有一个叠加图像。当用户双击我的overlayimage时,我需要放大/缩小。
叠加图像代码:
UIImageView *overlayImageView = [[UIImageView alloc]
initWithImage:[UIImage imageNamed:@"overlay.png"]];
[overlayImageView setFrame:CGRectMake(30, 100, 260, 200)];
[[self view] addSubview:overlayImageView];
[overlayImageView release];
答案 0 :(得分: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;
}
}