我想在alertView中添加一个活动指示器。 怎么做?
答案 0 :(得分:2)
我认为你可以做到这一点 -
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];
答案 1 :(得分:2)
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];
答案 2 :(得分:1)
查看教程here