【代码笔记】iOS-在导航栏中显示等待对话框
生活随笔
收集整理的這篇文章主要介紹了
【代码笔记】iOS-在导航栏中显示等待对话框
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一,效果圖。
二,代碼。
ViewController.m
#import "ViewController.h"@interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //在導航欄中顯示等待對話框 [self showActivityIndicatorViewInNavigationItem]; } //點擊任何處,停止等待指示器 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ //停止等待指示器,恢復導航欄 self.navigationItem.titleView = nil; self.navigationItem.prompt = nil; } #pragma -mark -functions //在導航欄中顯示等待對話框 -(void) showActivityIndicatorViewInNavigationItem { UIActivityIndicatorView *aiview = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; self.navigationItem.titleView = aiview; [aiview startAnimating]; self.navigationItem.prompt = @"數據加載中..."; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end轉載于:https://www.cnblogs.com/yang-guang-girl/p/7416558.html
總結
以上是生活随笔為你收集整理的【代码笔记】iOS-在导航栏中显示等待对话框的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【bzoj2245】[SDOI2011]
- 下一篇: linux查找文件find