我想在动画UIActivityIndi​​cator下创建阴影,以显示其他ui元素处于非 Activity 状态,例如键盘或警报视图下的阴影。做这个的最好方式是什么?

最佳答案

将背景为黑色且不透明度为50%的视图添加如下所示:

UIView *shadowView = [[UIView alloc] initWithFrame:yourFrame];
[shadowView setBackgroundColor:[UIColor blackColor]];
[shadowView setOpacity:0.5];

[yourCurrentView addSubview:shadowView];
[yourCurrentView bringSubviewToFront:yourActivityIndicator];

08-26 06:38