سؤال

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