问题描述
我实现了UISearchController
,并且从js回调中获取数据,但是当我在searchbar
中进行录音时,需要花费一些时间来放置数据,所以我想知道如何实现将indicator
加载到UISearchController
I implemented UISearchController
and I'm getting the data from a js callback but when I tape in the searchbar
it takes some time to put the data so I wanted to know how to implement a loading indicator
into the table view result of UISearchController
推荐答案
那时您开始搜索时,可以创建活动指标,并使用addSubView
方法将其添加为UISearchBar
的subview
. >
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];
完成搜索后,请使用removeFromSuperView
方法将其从搜索栏中删除.
When you finish the search remove it from the search bar using removeFromSuperView
method.
这篇关于带有加载指示器的UISearchController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!