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 7009995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:56:01+00:00 2026-05-27T21:56:01+00:00

I have a view which is created in IB. inside it I have a

  • 0

I have a view which is created in IB. inside it I have a scroll view created programmatically. Within the scroll view I connect to a web service and fetch the content and the image. I want to show an activity indicator while doing this. So I have:

- (void)viewDidLoad
{
    [super viewDidLoad];
    activityIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    activityIndicator.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
    activityIndicator.center = self.view.center;
    [self.view.window addSubview:activityIndicator];

And right after the scrollview is added, I have:

[self.view addSubview:scrollView];
// ADD Scroll View Ends


    //Add the Lisitng Image
    NSOperationQueue *queue = [NSOperationQueue new];
    NSInvocationOperation *operation = [[NSInvocationOperation alloc] 
                                        initWithTarget:self
                                        selector:@selector(loadImage) 
                                        object:nil];
    [queue addOperation:operation]; 

And in loadimage I have:

- (void)loadImage {

    [activityIndicator startAnimating];

I’ve tried [self.view.window addSubview:activityIndicator];, [self->ScrollView addSubview:activityIndicator];, [self.view addSubview:activityIndicator];

but I just can’t get the indicator to show. Anyone have any idea what might be wrong?

  • 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-05-27T21:56:01+00:00Added an answer on May 27, 2026 at 9:56 pm

    You should do this in you viewDidload

    - (void)viewDidLoad
    {
        //Start Activity Indicator View
        indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
        indicatorView.frame = CGRectMake(40.0, 20.0, 60.0, 60.0);
        indicatorView.center = self.view.center;
        [self.view addSubview:indicatorView];
        [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
        [indicatorView startAnimating];
    
        [self performSelectorInBackground:@selector(loadscroll) withObject:self];
    }
    

    Note: “performSelectorInBackground” will show you an activity indicator on the view and your loadScroll method will fetch all data from internet and do other work.

    -(void)loadscroll
    {
        //Your Scroll View 
            //Your other Data Manipulation even from internet
            //When data is fetched display it 
           [self removeActivityIndicator]; //To stop activity Indicator       
    }
    
    - (void)removeActivityIndicator
    {
           [indicatorView stopAnimating];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view controller which contains a scroll view. Inside the scroll view
I have created an Eclipse plugin which creates a view in Eclipse. Currently it
I have written a subclass of UIViewController which creates a view programmatically, instead of
I have a UITableView inside of a View created from a NIB. the table
I have a feature which allows the user to create projects and view it
I have a view which contains a form, the form posts and the data
I have a view which is composed of top, left and bottom headers and
I have a view which was working fine when I was joining my main
I have a view which I built in Interface builder with a tableview and
I have an admin view which contains four foreign keys each with a few

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.