UIProgressView
来源:互联网 发布:入驻淘宝达人账号简介 编辑:程序博客网 时间:2024/04/27 14:53
UIProgressView相关
- (void)viewDidLoad { [super viewDidLoad]; [self progressViewFun];}
//进度条相关-(void)progressViewFun{ self.view.backgroundColor = [UIColor blackColor]; CGRect screen = [[UIScreen mainScreen] bounds]; ///1.进度条 CGFloat progressViewWidth = 200; CGFloat progressViewHeight = 2; CGFloat progressViewTopView = 283; self.progressView = [[UIProgressView alloc] initWithFrame:CGRectMake((screen.size.width - progressViewWidth)/2 , progressViewTopView, progressViewWidth, progressViewHeight)]; [self.view addSubview: self.progressView]; ///2.Download按钮 UIButton* buttonDownload = [UIButton buttonWithType:UIButtonTypeSystem]; [buttonDownload setTitle:@"Download" forState:UIControlStateNormal]; CGFloat buttonDownloadWidth = 69; CGFloat buttonDownloadHeight = 30; CGFloat buttonDownloadTopView = 384; buttonDownload.frame = CGRectMake((screen.size.width - buttonDownloadWidth)/2 , buttonDownloadTopView, buttonDownloadWidth, buttonDownloadHeight); //指定事件处理方法 [buttonDownload addTarget:self action:@selector(downloadProgress:) forControlEvents: UIControlEventTouchUpInside]; [self.view addSubview:buttonDownload];}
//按钮点击事件- (void)downloadProgress:(id)sender { self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(download) userInfo:nil repeats:TRUE];}
//定时器事件-(void)download{ self.progressView.progress = self.progressView.progress + 0.1; if (self.progressView.progress == 1.0) { [self.timer invalidate]; UIAlertController* alertController = [UIAlertController alertControllerWithTitle:@"download completed!" message: @"" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleCancel handler:nil]; [alertController addAction:okAction]; //显示 [self presentViewController:alertController animated:true completion:nil]; } }
0 0
- UIProgressView
- UIProgressView
- UIProgressView
- UIProgressView
- UIProgressView
- UIProgressView
- UIProgressView
- UIProgressView
- UIProgressView
- UIProgressView
- UIProgressView
- UIProgressView进度条
- UIProgressView简介
- UI-UIProgressView
- UIProgressView 进度条
- UIProgressView/进度条
- UIProgressView 进度条
- 进度条 UIProgressView
- 【《代码整洁之道》精读与演绎】之四 优秀代码的格式准则
- 前端开发易忘细碎知识点笔记
- PDO的自带的获取自增id
- 【《代码整洁之道》精读与演绎】之五 整洁类的书写准则
- 日常思维练习(2)
- UIProgressView
- mysql优化概述
- eclipse整合tcmcat,构建并运行maven web项目
- 怎样删除软件残留在添加或删除程序中的信息?
- PAT甲级练习1011. World Cup Betting (20)
- 寒假篇14
- 自定义JSP中的Taglib标签之四自定义标签中的Function函数
- 华为手机在开发Android调试时logcat不显示输出信息的解决办法
- 奇妙的数字