Search code examples
iphoneiosuitableviewuiscrollviewfirst-responder

changing first responder from uiscrollview to uitableview mid-touch iOS iphone


I have a UITableView that is added to a UIScrollView for a necessary reason. Is it possible to switch the first responder from the uiscrollview to the uitableview after the scrollview has reached a certain contentOffset mid-touch? I tried...

-(void)scrollViewDidScroll:(UIScrollView*)scrollView{
    if(scrollView.contentOffset.y >= 100){
        [scrollView resignFirstResponder];
        [tableView becomeFirstResponder];
    }
}

But after 100, the scrollView is the one that still moves.


Solution

  • It doesn't work that way. Once a view has been identified via hitTest:withEvent: to receive a touch, it will also receive all the updates for that touch and you're not able to redirect the touches without bad hacks.