Created
March 11, 2013 03:28
-
-
Save helloworld116/5131697 to your computer and use it in GitHub Desktop.
ios:customcontrol:SVProgressHUD:页面切换等场景下显示程序当前运行状态
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//下载路径 https://github.com/samvermette/SVProgressHUD | |
// | |
// SVProgressHUDViewController.m | |
// SVProgressHUD | |
// | |
// Created by Sam Vermette on 27.03.11. | |
// Copyright 2011 Sam Vermette. All rights reserved. | |
// | |
//SVProgressHUD使用范例 | |
#import "ViewController.h" | |
#import "SVProgressHUD.h" | |
@implementation ViewController | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { | |
return YES; | |
} | |
#pragma mark - | |
#pragma mark Show Methods Sample | |
- (void)show { | |
[SVProgressHUD show]; | |
} | |
- (void)showWithStatus { | |
[SVProgressHUD showWithStatus:@"Doing Stuff"]; | |
} | |
static float progress = 0.0f; | |
- (IBAction)showWithProgress:(id)sender { | |
progress = 0.0f; | |
[SVProgressHUD showProgress:0 status:@"Loading"]; | |
[self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.3]; | |
} | |
- (void)increaseProgress { | |
progress+=0.1f; | |
[SVProgressHUD showProgress:progress status:@"Loading"]; | |
if(progress < 1.0f) | |
[self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.3]; | |
else | |
[self performSelector:@selector(dismiss) withObject:nil afterDelay:0.4f]; | |
} | |
#pragma mark - | |
#pragma mark Dismiss Methods Sample | |
- (void)dismiss { | |
[SVProgressHUD popActivity]; | |
} | |
- (void)dismissSuccess { | |
[SVProgressHUD showSuccessWithStatus:@"Great Success!"]; | |
} | |
- (void)dismissError { | |
[SVProgressHUD showErrorWithStatus:@"Failed with Error"]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment