chogath chogath - 1 year ago 143
iOS Question

UISearchController with loading indicator

I implemented

and I'm getting the data from a js callback but when I tape in the
it takes some time to put the data so I wanted to know how to implement a loading
into the table view result of

Answer Source

When you start searching at that time you can create an activity indicator and add it as the subview of UISearchBar using addSubView method.

  UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];

//set your frame for activity indicator

[searchBar addSubview: spinner];

[spinner startAnimating];

When you finish the search remove it from the search bar using removeFromSuperView method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download