iPhone / iPad上UIActivityIndi​​cator下的影子

时间:2010-11-24 09:29:58

标签: ios objective-c iphone uiview uiactivityindicatorview

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

1 个答案:

答案 0 :(得分:3)

将具有黑色背景和不透明度的视图添加到50%,如下所示:

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

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