您的位置:首页 > 产品设计 > UI/UE

UIActivityIndicatorView

2016-05-03 15:03 567 查看
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

[self showWaitingView];
}

- (IBAction)buttonClick:(id)sender {
[self removeWaitingView];
}

- (void)showWaitingView {

CGRect frame = CGRectMake(90, 190, 32, 32);
UIActivityIndicatorView* progressInd = [[UIActivityIndicatorView alloc] initWithFrame:frame];
[progressInd startAnimating];
progressInd.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;

frame = CGRectMake(130, 193, 140, 30);
UILabel *waitingLable = [[UILabel alloc] initWithFrame:frame];
waitingLable.text = @"Processing...";
waitingLable.textColor = [UIColor whiteColor];
waitingLable.font = [UIFont systemFontOfSize:20];
waitingLable.backgroundColor = [UIColor clearColor];
frame = [UIScreen mainScreen].bounds;
UIView *theView = [[UIView alloc] initWithFrame:frame];
theView.userInteractionEnabled = NO;
theView.backgroundColor = [UIColor blackColor];
theView.alpha = 0.7;
theView.tag = 999;
[theView addSubview:progressInd];
[theView addSubview:waitingLable];

[self.view addSubview:theView];
[self.view bringSubviewToFront:theView];

}

- (void)removeWaitingView {
UIView *v = [self.view viewWithTag:999];
if(v) [v removeFromSuperview];

}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

@end

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: