Add a slight delay before sending the request and then cancel this request with a delay if the user continues to print
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { [NSObject cancelPreviousPerformRequestsWithTarget:self]; [self performSelector:@selector(sendSearchRequest) withObject:searchText afterDelay:0.1f]; }
You may need to adjust the delay time. too long, and itβs noticeable to the user that there is a delay, too short, and you have the same problem as now.
source share