我已经阅读了一些关于这个特定主题的答案,但由于某种原因,我的代码似乎不起作用。它在 UISearchBarDelegate 委托(delegate)方法 -(void)searchBarSearchButtonClickedUISearchBar *)searchBar
UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
UIBarButtonItem *activity = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];
[[self navigationItem] setRightBarButtonItem:activity];
[activity release];
[activityIndicator startAnimating];
非常感谢任何帮助或建议!
Best Answer-推荐答案 strong>
我相信 UIActivityIndicatorView 的指定初始化程序是 initWithActivityIndicatorStyle: 。尝试像这样创建 activityIndicator 。
UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
关于iphone - UINavigationBar 中的事件指示器,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/7426368/
|