ActivityIndicatorView和ProgressView
2015-11-07 21:20
507 查看
ActivityIndicatorView和ProgressView
- (IBAction)upload:(UIButton *)sender { //开始和暂停 if ([self.activityIndicatorView isAnimating]) { [self.activityIndicatorView stopAnimating]; }else{ [self.activityIndicatorView startAnimating]; } } - (IBAction)download:(UIButton *)sender { //开启一个定时器 间隔1.0 myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(download) userInfo:nil repeats:YES]; } - (void)download{ //没一秒递进0.1 self.progressView.progress += 0.1; if (self.progressView.progress == 1.0) { [myTimer invalidate]; //完成后让定时器失效 然后显示一个弹出框 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert]; // Create the actions. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { NSLog(@"The \"Okay/Cancel\" alert's cancel action occured."); }]; UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"other" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"The \"Okay/Cancel\" alert's other action occured."); }]; // Add the actions. [alertController addAction:cancelAction]; [alertController addAction:otherAction]; [self presentViewController:alertController animated:YES completion:nil]; } }
自从8.0之后不推荐使用UIAlertView
相关文章推荐
- hdu1087
- Apple ID设置教程指南
- Apple ID设置教程指南
- c++模板函数
- Linux中的进程关系详解
- acmicpc-asia-tokyo-regional-contestC-Shopping(贪心)
- 关于java单例模式getInstance()
- Maven之——编译文件的编码设置
- GDB 使用入门
- mac pro扩展显示器 没有显示
- IOS7以上的UITableView顶部空白的问题
- Android进阶之_实现滑动的7种方式详解
- HDU 2600 War
- 算法-排序-选择排序(直接选择和堆排序)
- 数据结构基础5.1:树的遍历(递归与非递归实现)
- 检测亚像素级角点
- C语言中,注释不能嵌套
- 架构设计最佳实践与必备素养
- 111 js iframe表单提交后自动关闭 &
- java编程,格式化数字小数位