无法显示活动指示器iOS

LUI*_*LUI -1 iphone objective-c ios

我想UIActivityIndicatorviewDidLoad屏幕上显示.它在另一个项目中工作,但不知道为什么它不会在这里显示.

我从viewDidLoad其他屏幕调用showSplashScreen .

+(void) showSplashScreen
{
    UIView *mainScreen = [[[UIApplication sharedApplication]delegate]window];

    UIView *windowBlocker = [[UIView alloc]initWithFrame:mainScreen.frame];
    windowBlocker.tag = 999;
    windowBlocker.backgroundColor = [UIColor clearColor];

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((mainScreen.frame.size.width), (mainScreen.frame.size.height), 50, 50)];
    imageView.layer.backgroundColor=[[UIColor colorWithRed:200 green:0 blue:0 alpha:0.5] CGColor];

    imageView.layer.cornerRadius=10;
    imageView.layer.masksToBounds = YES;
    [windowBlocker addSubview:imageView];

    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    [windowBlocker addSubview:spinner];
    spinner.center = mainScreen.center;
    [spinner startAnimating];
}
Run Code Online (Sandbox Code Playgroud)

什么都没发生.任何的想法?我正在尝试iPad.

小智 5

 UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    [imageView addSubview:spinner];
    spinner.center = mainScreen.center;
    [windowBlocker addSubview:imageView];
    [self.view addSubview: mainScreen];
    [spinner startAnimating];
Run Code Online (Sandbox Code Playgroud)