iOS UIActivityIndicatorView

来源:互联网 发布:画装修设计图软件 编辑:程序博客网 时间:2024/04/27 02:22
-(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:@"加载中..."];

0 0