You should hide your UIScrollView
when it is in the default position:
scrollView.hidden = YES;
This will prevent the UIScrollView
from blocking touches on the buttons beneath it.
See Apple's UIView doco:
A hidden view disappears from its window and does not receive input events. It remains in its superview’s list of subviews, however, and participates in autoresizing as usual.
Then set hidden to NO just before you drag down the curtain.
EDIT:
To answer the questions in your comment:
How would I know if my scroll view is in default position, there is no event triggered? You should be able to determine if your scroll view is in the default (hidden) position or in the down position (showing) by checking the
contentOffset
property on your scroll view.Wouldn't the image of the curtain disappear if I set it to hidden? Yes, it would. If you want the view to still be partially showing at the top and not disappear completely, you'll need a different approach (see some suggestions below).
The scroll view is supposed do be 'dragged down' with the finger (of course). So it needs events triggering at all time. You can detect a touch/pan gesture on the main view, and cause the scrollview to move down/up based on that gesture. The gesture doesn't actually need to start inside the scrollview.
Here are some links that I found helpful:
- PullableView for iOS - This is a nice and simple example of how to implement a pull down/up/across view. I'd suggest downloading the code from github and having a look through it.
- Implementing an iOS notification center pulldown
- Touch and pull down a view - This is a similar SO question to yours. See this answer in particular, I'm fairly sure it uses a
UIScrollView
in the same way you are. - Drag Down UIView in iOS 5 - This SO question also has some good answers.
Hope this helps!