0

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

kiri
  • 1,977
  • 5
  • 27
  • 55

1 Answers1

0

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.

SAE
  • 1,609
  • 2
  • 18
  • 22