2012-09-27 36 views

回答

1

謝謝...我在做同樣的,但它並沒有爲我工作...現在我正在通過使用UIButton而不是UIImageView來做到這一點。我附加處理器的按鈕,設置button.backgroundImage,然後得到的圖像在任何地方,我想...無論如何。 :)

0

這是我用在我的項目&它工作正常。

UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; 
    [self.view addGestureRecognizer:singleFingerTap]; 

- (void)handleSingleTap:(UITapGestureRecognizer *)recognizer { 
    CGPoint location = [recognizer locationInView:[recognizer.view superview]]; 


    //Do stuff here... 
    // I assume that your imgview is imgView11 

    if (imgView11.frame.origin.x < location.x && location.x < something 
     && imgView11.frame.origin.y < location.y && location.y < something) { 

     largeImgView.image = imgView11.image; 
    } 
} 

如果你可以分享你的代碼部件,那麼我將編輯我的回答對HP解決您的問題