I have a strange problem where I have a scroll view on one of my views that works perfectly on 4-inch devices, both in simulator and actual device. That same scroll view (and views inside it) doesn't respond to any touch event (both tap and scroll) in 3.5-inch devices (same iOS version, 7.0.3). It renders/displays perfectly though. I've even tried to add a tap handler to the view itself directly to see if it will hit (categoriesScrollView is my view):
//viewDidLoad:
UITapGestureRecognizer *test = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(test)];
[categoriesScrollView addGestureRecognizer:test];
-(void)test{
NSLog(@"test");
}
It doesn't hit. Inside the view there are buttons, that can be tapped perfectly on an 4-inch device. This problem occurs both on device and simulator. The first thing that I checked was any device/screensize-specific code, but there isn't any. The second thing I've checked is the layout constraints: Maybe the scrollview's actual bounds was getting smaller (maybe even zero) on 3.5 inch device, but I've checked the frames and everything is normal (the scroll view has clipsToBounds
set to YES
anyway, so if this was the case, the content would be invisible anyway).
All the other views inside the same view other than this scroll view and its subviews are receiving touch/running perfectly normal. I can't think of anything else, what can be causing this?
userInteractionEnabled
set to YES in both cases? Furthermore, could it be that on the 3.5 inch "version" some transparent view (or a portion of it) gets above your scrollView and swallows the touch events? – Andrea SpregauserInteractionEnabled
isYES
in every case (I don't touch it anyway and it's set to YES in IB, but still, checked it at runtime) I've also thought about another view overlapping and consuming the touches, but it's apparently not the case. there is another scroll view below that, and to check if that overlaps my problematic view, i've also added a gesture recognizer to output something else, and it does output correctly when I tap it, but doesn't output anything when I tap my the problematic view. if the other scroll view did overlap this view, it should have outputted in any case. – Can PoyrazoğluscrollViewWillBeginDragging:
and see if it gets called? If not, you should try with a "fake" temporary subclass for your UIScrollView and implement the–touchesBegan:withEvent:
,–touchesMoved:withEvent:
,–touchesEnded:withEvent:
methods (fromUIResponder
) to see if they get called. If you do create this subclass, don't forget to set the custom class name in Interface Builder. NOTE: I'd remove the test gesture recognizer as it may cancel the touch event once processed. – Andrea SpregaclipsToBounds
set noNO
and the indicator was pushing the size of the top bar to almost zero, making the scroll view draw but not respond to touch. – Can Poyrazoğlu