开发者

Adding activityindicatorin alertVIew

开发者 https://www.devze.com 2023-02-28 06:45 出处:网络
I want to add a activity i开发者_如何转开发ndicator in alertView. How to do this?I think you can do by this -

I want to add a activity i开发者_如何转开发ndicator in alertView. How to do this?


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];


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];


Check the tutorial here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号