I have this application in which I have a right bar button item which adds the search bar as title view. This works fine but when the table view is scrolling, this doesn't happen. It only adds when the table view has stopped scrolling.

Any way to handle this?

有帮助吗?

解决方案

The main thread does not responds to events if its busy, use GCD to add this to Queue

Check if this function is called while scrolling. If yes , then simply using GCD will solve your problem.

-(void)userTapOnRightBarButton{
    NSLog(@"Main thread response to touch during scrolling"):
    dispatch_async(dispatch_get_main_queue(), ^{
           [self addSearchBar];
   });
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top