0

以下に示すように、ネットワークインジケーターを呼び出して、このコードの後でそれを閉じようとしていますが、ステータスバーには表示されません。私は何を間違っていますか?ネットワークアクティビティがすぐに完了しただけだと思っていましたが、スリープ状態でも機能していないようです.

-(void)applicationDidBecomeActive:(UIApplication *)application {

UIImageView *loadingImage = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
loadingImage.image = [UIImage imageNamed:@"loading-splash.png"];
loadingImage.contentMode = UIViewContentModeCenter;
[self.window addSubview:loadingImage];


[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
NSData *dataURL =  [NSData dataWithContentsOfURL: [ NSURL URLWithString: @"http://mysite.tk/in-app/net.test" ]];
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];
NSLog(@"%@", serverOutput);
sleep(1);
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

    if([serverOutput isEqualToString:@"internet is working"])
    {
        [SVStatusHUD showWithImage:[UIImage imageNamed:@"connected.png"] status:@"Connected"];


    } else {

        UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Connection Unsuccesful" message:@"App Requests has failed connecting to the server. Some or all of App Requests functions may not work. Please check your internet connection."
                                                              delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [alertsuccess show];
        [alertsuccess release];

            }

[loadingImage release]; 
}

また、誰かが画像ビューを閉じる方法を教えてくれるほど親切になりたい場合は、お気軽にどうぞ. チュートリアルなどから学ぼうとしている初心者です。

4

1 に答える 1