Я обычно создаю UIView, который создается по мере необходимости.Вот код, который вы можете попробовать в своем собственном приложении:
- (id)initWithLabel:(NSString*)labelName {
self = [super init];
if (self) {
UIImageView *loadingBackgroundView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 150, 120, 40)];
[loadingBackgroundView setBackgroundColor:[UIColor blackColor]];
[loadingBackgroundView setAlpha:0.9];
[loadingBackgroundView.layer setCornerRadius:8.0];
[loadingBackgroundView.layer setBorderColor:[[UIColor clearColor] CGColor]];
[self addSubview:loadingBackgroundView];
[loadingBackgroundView release];
UILabel *loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake (125, 160, 100, 20)];
[loadingLabel setBackgroundColor:[UIColor clearColor]];
[loadingLabel setTextAlignment:UITextAlignmentCenter];
[loadingLabel setTextColor:[UIColor whiteColor]];
[loadingLabel setText:labelName];
[self addSubview:loadingLabel];
[loadingLabel release];
UIActivityIndicatorView *loadingActivityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(110,160,20,20)];
[loadingActivityIndicatorView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge];
[loadingActivityIndicatorView startAnimating];
[self addSubview:loadingActivityIndicatorView];
[loadingActivityIndicatorView release];
}
return self;
}
Это даст вам нечто похожее на приведенное ниже: