且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

带有加载指示器的UISearchController

更新时间:2023-12-05 16:49:46

那时您开始搜索时,可以创建活动指标,并使用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.