Gypsa
Gypsa

Reputation: 11314

Adding activityindicatorin alertVIew

I want to add a activity indicator in alertView. How to do this?

Upvotes: 2

Views: 574

Answers (3)

pawan
pawan

Reputation: 21

UIAlertView *alert;



alert = [[[UIAlertView alloc] initWithTitle:@"Configuring Preferences\nPlease Wait..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];
[alert show];

UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

// Adjust the indicator so it is up a few pixels from the bottom of the alert
indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
[indicator startAnimating];
[alert addSubview:indicator];
[indicator release];

Upvotes: 2

saadnib
saadnib

Reputation: 11145

I think you can do by this -

    UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:@"title" message:@"\n\n" delegate:nil cancelButtonTitle:@"cancel" otherButtonTitles:nil];
    UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(130.0f, 50.0f, 20.0f, 20.0f)];
    [activityIndicator startAnimating];
    [alertview addSubview:activityIndicator];
    [alertview show];
    [alertview release];
    [activityIndicator release];

Upvotes: 2

PgmFreek
PgmFreek

Reputation: 6402

Check the tutorial here

Upvotes: 1

Related Questions