2013-03-04 80 views
1

我有一個包含縮放圖像的UIImageView。圖像大小爲3264 x 2448,並且UIImageView contentMode設置爲AspectFit。該的UIImageView的大小爲320×427,我有以下看法層次:UIImageView觸摸點

WorkspaceView : UIView 
    -> UIImageView (Contains the image) 
    -> A UIView which contains a UITapGestureRecognizer 

我目前想從基礎上的UIImageView(其中有一個大的XY座標空間 - 2448)觸摸的座標。 UIView基於自己的觀點而不是它的超級觀點引發了一種聯繫。它封裝了UITapGestureRecognizer,以便引發一個委託調用。

如何在UIView內部提供座標時獲得縮放的XY觸摸點?我試過下面的代碼,它似乎並沒有工作:

- (void)lineView:(LineView *)aLineView requestsDistanceForLine:(Line *)line { 
    // aLineView is the subview 
    // line contains the startpoint and endpoint of the aLineView - it's the model 
    // capturedImageView is the local instance of the scaled UIImageView 
    CGPoint startPoint =[self convertPoint:[line startPoint] toView:self.capturedImageView]; 
} 

startPoint結果太小了。有什麼想法嗎?

回答