I have a table view, and I'm adding a sub view directly to the table view with addSubview:
. I am displaying this view at the position CGRectMake(0.0f, -30.0f, tableView.frame.size.width, 30.0f)
(so this displays above the scrollable area of the table, when the user scrolls slightly beyond the bounds of the scroll area). I then do this:
- (void) scrollViewDidScroll:(UIScrollView *)scrollView {
if(scrollView.contentInset.top + scrollView.contentOffset.y < -30.0f) {
[scrollView setContentOffset:CGPointMake(1.0f, -30.0f)-scrollView.contentInset.top animated:NO];
}
}
So that when a user scrolls up and into the negative space in the table view, that when they release, they can still see the view I insert at y=-30 so that the table does not "snap back" to 0.
This all works exactly like I want it to. However, when the table's contentOffset
is set to a negative y value such as [scrollView setContentOffset:CGPointMake(1.0f, -30.0f)-scrollView.contentInset.top animated:NO]
, then touches are NOT recognized on both the cells of my table, nor the view I inserted directly into the table. I am wondering how I can set contentOffset to a value such as this, and still have child views of my tableView, as well as cells, register touches.