[SVProgressHUD show];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// time-consuming task
dispatch_async(dispatch_get_main_queue(), ^{
[SVProgressHUD dismiss];
});
});
#import <SVProgressHUD.h>
#import "SVProgressHUD.h"
[SVProgressHUD showWithStatus:@"加载中,请稍后。。。"];
progressValue += 0.1;
[SVProgressHUD showProgress:progressValue status:@"加载中"];
[SVProgressHUD dismiss];
或者[SVProgressHUD dismissWithDelay:1.0];
[SVProgressHUD showErrorWithStatus:@"当前网络不稳定,请稍后重试"];
[SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
[SVProgressHUD setBackgroundColor:[UIColor blackColor]];
[SVProgressHUD setForegroundColor:[UIColor whiteColor]];
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleNotification:)
name:SVProgressHUDWillAppearNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleNotification:)
name:SVProgressHUDDidAppearNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleNotification:)
name:SVProgressHUDWillDisappearNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleNotification:)
name:SVProgressHUDDidDisappearNotification
object:nil];
}
`2.0-beta8`