Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8662001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:37:54+00:00 2026-06-12T16:37:54+00:00

In my app data comes from web service and I have implemented code to

  • 0

In my app data comes from web service and I have implemented code to show activity indicator.
I fetch data from web service in viewWillAppear().

The issue is that the indicator is shown only once when first time viewWillAppear() is called and after that whenever viewWillAppear() method is called indicator is not showing.

My code is as follows :-

-(void)viewDidAppear:(BOOL)animated
{
    //Initializaing  views for Acticity Indicators
   loadingview = [[LoadingView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];    
    Tickview=    [[tickview alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];   
}

-(void)viewWillAppear:(BOOL)animated
{
        Reachability *r = [Reachability reachabilityWithHostName:@"www.google.com"];
        NetworkStatus internetStatus = [r currentReachabilityStatus];
        if ((internetStatus == ReachableViaWiFi) || (internetStatus == ReachableViaWWAN))
        {                 
           [NSThread detachNewThreadSelector:@selector(startTheBackgroundJob) toTarget:self withObject:nil];

        }
        else
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Check Your Internet Connection. Internet   Connection is not active" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alert show];
            [alert release];
        }       
}

- (void)startTheBackgroundJob
{
    [self performSelectorOnMainThread:@selector(loading) withObject:nil waitUntilDone:YES];

}

-(void)loading
{
     //
     //some database operations here..
     //


    //after that showing the activity indicator
    [NSThread detachNewThreadSelector:@selector(threadAnimates:) toTarget:self withObject:nil];



    //retriving data from web service..   
    [self retrieveData];


    //than removing loadingview
     [loadingview removeFromSuperview];
     [loadingview setHidden:YES];

    [NSThread detachNewThreadSelector:@selector(tickshow:) toTarget:self withObject:nil];
    [self performSelector:@selector(tickhide:) withObject:nil afterDelay:2]; 

}

 - (void) threadAnimates:(id)data
{
[self.view addSubview:self.loadingview];

[loadingview setHidden:NO];

}

-(void)tickshow:(id)sender
{
    [self.view addSubview:Tickview];
    [loadingview setHidden:NO];
}

-(void)tickhide:(id)sender
{
    [Tickview removeFromSuperview];
    [Tickview setHidden:YES];
}

And when i put break point for dubegging , the indicator is again showing, but when remove the break point , the indicator is not showing.

I have imported seperate files for loadingview and tickview both in .h file and in project.

I have tried a lot but could not get the solution.

Please help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:37:55+00:00Added an answer on June 12, 2026 at 4:37 pm

    try this code

    -(void)viewDidAppear:(BOOL)animated
    {
        //Initializaing  views for Acticity Indicators
       loadingview = [[LoadingView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];    
        Tickview=    [[tickview alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];   
        [loadingview startAnimating];
       [self.view addSubview:loadingview];
    
       [self.view bringSubviewToFront: loadingview];
    }
    

    Edited :

    also try bellow code for just add Activity Indicator in view

            UIActivityIndicatorView *spinningWheel = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(10.0, 11.0, 25.0, 25.0)];
            [spinningWheel startAnimating];
            spinningWheel.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
            [self.view addSubview:spinningWheel];
            [spinningWheel release];
    

    i hope this help you..

    🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web app built in coldfusion that receives medical referral letters from
I am writing an app can load data from from web, then put the
I'd like to accept requests from a php app to my web service. How
I have a customer service web app requirement, which requires that I work pull
My app needs to grab some data from the web at a specific time
In my app, I get data from Webservices. The data comes in form of
I have a layered application with namespaces: App.Core - business layer logic services App.Data
I'm running into a crash issue while developing an iPhone app with Core Data.
I am sending a POST request to a web-service which returns data in XML
Here is what's happening in my RESTful web app: HTTP request comes in The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.