0
votes

I am working on search functionality in my application, I am having list of items based on predicate i am writing the search operation. Search will be based on each character, While doing this search keyboard is responding very late,

I am doing search functionality in delegate method,

  • (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText{

Can any one suggest how can i solve this issue.

Regards

1

1 Answers

0
votes

The UI (here, the keyboard) is always updated on the main thread and it may get laggy, if the search task is slow. Therefore, you should perform it on a separate thread; e.g. by performSelectorInBackground. Then the main thread will have enough resources for the keyboard.

See the Threading Programming Guide for examples.