本文介绍了带有加载指示器的UISearchController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了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方法将其添加为UISearchBarsubview. >

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 12:04