我在我的應用程序中實現了旋轉,匹克,輕拍手勢識別器。我有一個圖像視圖,我獲取用戶圖像,然後有按鈕移動到郵票視圖,其中有120個可滾動的郵票圖像1000 * 。問題是,當我選擇一個郵票圖像時,手勢工作正常。但是當我再次移動到郵票視圖並選擇郵票時,第一個郵票變爲靜態,並且不識別任何手勢,只有當前郵戳識別手勢。 我正在執行的是選擇多個郵票,然後我可以旋轉他們,拉伸他們,捏他們。 這裏是一個我很implementing.Just幫助我如何達致這代碼...如何在相同的圖像視圖上實現不同的GestureRecognizer?
-(void)viewWillAppear:(BOOL)animated
{
if (stampImageView) {
[stampImageView release];
}
stampImageView=[[UIImageView alloc]initWithFrame:CGRectMake(self.view.center.x-100, 200, 80, 80)];
stampImageView.tag=(int)mAppDel.frameImageString;
NSLog(@"tag is %@",stampImageView.tag);
stampImageView.userInteractionEnabled=YES;
if(mAppDel.frameImageString)
stampImageView.image=[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:mAppDel.frameImageString ofType:@"png"]];
[self.view addSubview:stampImageView];
stampImageView.userInteractionEnabled=YES;
[self.view bringSubviewToFront:stampImageView];
UIRotationGestureRecognizer *rotationGesture = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotatePiece:)];
[stampImageView addGestureRecognizer:rotationGesture];
[rotationGesture release];
UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(scalePiece:)];
[pinchGesture setDelegate:self];
[stampImageView addGestureRecognizer:pinchGesture];
[pinchGesture release];
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panPiece:)];
[panGesture setMaximumNumberOfTouches:1];
[panGesture setDelegate:self];
[stampImageView addGestureRecognizer:panGesture];
[panGesture release];
}
是的,我嘗試過這種方法,以及返回肯定的,但什麼都沒有發生,而且當我移動在針對當前郵票,我可以看到以前的郵票觀點是返現小號咚咚view.Just幫我兄弟在這種情況下 – Sabby 2011-05-04 07:01:59