views:

182

answers:

2

while restoring some data i am displaying a activity indicator..but i want the background image to become dull or dim a bit so that the focus is on activity indicator..i have seen that in some applications but cant figure out how to achieve that??

+1  A: 

Take a look at MBProgressHUD which is an open source framework for displaying various kinds of activity indicators on top of other views.

Claus Broch
+3  A: 

Instead of adding just activity indicator, add black or white subview (make its size the same as background size), and set your subview's alpha to 0.5 (you can adjust it any way you like). Then put activity indicator on this black or white subview. Hope this is the effect you are looking for. Here's some sample code:

DisabledView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 480.0)];
[DisabledView setBackgroundColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.2]];

[self addSubview:DisabledView];

SearchBarIndicator = [[[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 25.0f, 25.0f)] autorelease];
[SearchBarIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
[SearchBarIndicator setCenter:CGPointMake(160, 160)];
[DisabledView addSubview:SearchBarIndicator];
Marichka