将活动指示器添加到导航控制器栏
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将活动指示器添加到导航控制器栏相关的知识,希望对你有一定的参考价值。
This adds a spinning activity indicator to the top navigation bar of a navigation controller.
// stop activity indicator UINavigationController *tempNavigationController = [self.navigationController.viewControllers objectAtIndex:2]; CGRect frame = CGRectMake(0.0, 0.0, 25.0, 25.0); UIActivityIndicatorView *loading = [[UIActivityIndicatorView alloc] initWithFrame:frame]; [loading sizeToFit]; loading.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); UIBarButtonItem *statusInd = [[UIBarButtonItem alloc] initWithCustomView:loading]; statusInd.style = UIBarButtonItemStylePlain; [tempNavigationController.navigationItem setRightBarButtonItem: statusInd animated:YES];
以上是关于将活动指示器添加到导航控制器栏的主要内容,如果未能解决你的问题,请参考以下文章