El *_*apo 1 transparency cocoa-touch objective-c uiview ios
我正在尝试在iOS中创建一个视图,让用户知道他们的数据正在加载...它应该在中间有一个200x200的圆角框,带有一个微调器和"Data Loading ..."字样和一个透明的背景.
除了我的200x200圆角盒也是透明的,这一切都正常.
这是我正在使用的代码:
UIView *loadingDataView = [[UIView alloc] initWithFrame:CGRectMake(0, 44, 320, 367)];
loadingDataView.alpha = 0.4;
loadingDataView.backgroundColor = [UIColor clearColor];
UIView *viewWithSpinner = [[UIView alloc] initWithFrame:CGRectMake(110, 106, 100, 100)];
[viewWithSpinner.layer setCornerRadius:15.0f];
viewWithSpinner.backgroundColor = [UIColor blackColor];
UILabel *msg = [[UILabel alloc] initWithFrame:CGRectMake(5, 75, 90, 20)];
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(5, 5, 90, 70)];
spinner.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
[spinner startAnimating];
msg.text = @"Data Loading";
msg.font = [UIFont systemFontOfSize:14];
msg.textAlignment = UITextAlignmentCenter;
msg.textColor = [UIColor whiteColor];
msg.backgroundColor = [UIColor clearColor];
viewWithSpinner.opaque = NO;
viewWithSpinner.backgroundColor = [UIColor blackColor];
[viewWithSpinner addSubview:spinner];
[viewWithSpinner addSubview:msg];
[loadingDataView addSubview:viewWithSpinner];
[self.view addSubview:loadingDataView];
Run Code Online (Sandbox Code Playgroud)
谢谢.
| 归档时间: |
|
| 查看次数: |
3399 次 |
| 最近记录: |