How to display activity indicator in center of UIAlertController?

后端 未结 13 1124
猫巷女王i
猫巷女王i 2020-12-08 05:18

I currently have a UIAlertController being displayed on the screen. The view of the alert should only display 2 elements, a title and a UIActivityIndicato

13条回答
  •  南笙
    南笙 (楼主)
    2020-12-08 05:32

    Well try this code.

    UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
                                        message:@"Creating new user\n\n\n"
                                 preferredStyle:UIAlertControllerStyleAlert];
    
    UIActivityIndicatorView *loader = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    loader.center = CGPointMake(130.5, 65.5);
    loader.color = [UIColor blackColor];
    [loader startAnimating];
    [alert.view loader];
    [self presentViewController:alert animated:NO completion:nil];
    

提交回复
热议问题