0
蔭開發IAM使用一個uiimageview.And拍攝圖像,圖一個application.In並添加到第一imageview.And加入uitapgesturerecognizer行動第二imageview.If第二imageview的可以只出現了第一的ImageView的,如果我們點擊這個在imageview之外,那麼它不檢測手勢動作。所以請告訴我如何解決這個問題。我的代碼就像下面這樣。如何使用手勢操作將一個ImageView添加到另一個ImageView?
UIImageView *img1=[[UIImageView alloc]initWithFrame:CGRectMake(100,100,500 ,500)];
[self.view addsubview:img1];
float x=[[xvalues objectAtIndex:h] floatValue];
float y=[[yvalues objectAtIndex:h] floatValue];
UIImage *pinimage=[UIImage imageNamed:@"PINpurple.png"];
UIImageView *img3=[[UIImageView alloc]initWithFrame:CGRectMake(x-pinimage.size.width,y-pinimage.size.height,pinimage.size.width ,pinimage.size.height)];
img1.userInteractionEnabled=YES;
img3.userInteractionEnabled=YES;
UITapGestureRecognizer *tap5=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(calculate:)];
tap5.delegate=self;
[img3 addGestureRecognizer:tap5];
[img1 addSubview:img3];
這裏xvalues和yvalues是兩個數組。
No.請簡要說明。 – user1400581
請看看這篇文章http://stackoverflow.com/questions/1694529/allowing-interaction-with-a-uiview-under-another-uiview和http://bynomial.com/blog/?p=74希望能幫助到你 。 – Suhaiyl