-(void) loading:(NSString *)loadingMessage{
loadingView = [[UIView alloc] initWithFrame:CGRectMake((self.view.frame.size.width-400)/2, (self.view.frame.size.height-200)/2, 400, 200)];
loadingView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
loadingView.layer.masksToBounds = YES;
loadingView.layer.cornerRadius = 15;
[self.view addSubview:loadingView];
UILabel *message = [[UILabel alloc] initWithFrame:CGRectMake(10, 40, 380, 20)];
message.text = [NSString stringWithFormat:@"%@",loadingMessage];
message.textColor = [UIColor whiteColor];
message.font = [UIFont systemFontOfSize:24.0];
message.textAlignment = NSTextAlignmentCenter;
[loadingView addSubview:message];
UIActivityIndicatorView *loading = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
loading.frame = CGRectMake((400-50)/2, 200-80, 50, 50);
loading.backgroundColor = [UIColor clearColor];
[loading startAnimating];
[loadingView addSubview:loading];
}
//调用
[self loading:@"加载中..."];
iOS UIActivityIndicatorView
最新推荐文章于 2022-03-02 11:15:11 发布