2011-04-14 26 views
0

誰能給我的原因爲什麼UIPanGestureRecognizerUIImageView不工作和UIView工作的確切原因我沒有找到任何博客。下面是我的代碼(現在的工作)UIPanGestureRecognizer只爲uiview而不是爲uiimageview

UIView *endImage=[[UIView alloc]init]; 

    endImage.backgroundColor=[[UIColor yellowColor] colorWithAlphaComponent:0.3f]; 
    UIPanGestureRecognizer *panOnEndImage = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanOnLine:)]; 

    panOnEndImage.delegate=self; 
    [endImage addGestureRecognizer:panOnEndImage]; 
    [anotherUIView addSubview:endImage]; 
    [panOnEndImage release]; 

如果我改變endimage爲UIIMageView對象則該聲像是不工作...在此先感謝您的建議是更重要的。

+1

請添加此行並嘗試。 [endImage setUserInteractionEnabled:YES]; – Ravin 2011-04-14 06:30:25

+0

謝謝你拉文的工作很好... – ajay 2011-04-14 06:42:33

回答

2

請添加此行並嘗試。 [endImage setUserInteractionEnabled:YES];所以這是答案。(right;)!

相關問題