I have an imageview in my scrollview,and i add a tap gesture for my uiscrollview.
only the imageview area can respond tap gesture.
why when i set the backgroudcolor property of scrollview,then the whole scrollview can respond tap gesture。</p>
here is my code。</p>
UIImageView * imgview=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bizhi1.png"]];
imgview.frame=CGRectMake(0, 140, 320, 200);
UIScrollView * scrollview=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[scrollview addSubview:imgview];
//when i set the backgroudcolor,then the whole scrollview can respond tap gesture
//scrollview.layer.backgroundColor=[UIColor redColor].CGColor;
//add a TapGesture for scrollview
UITapGestureRecognizer * tapGesture=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SwitchTabBarHidden)];
[scrollview addGestureRecognizer:tapGesture];
[tapGesture release];
[imgview release];
[self.view addSubview:scrollview];
[scrollview release];