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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:05:11+00:00 2026-06-01T15:05:11+00:00

I am using Xcode 4.2 on Snow Leopard. What I am trying to do.

  • 0

I am using Xcode 4.2 on Snow Leopard. What I am trying to do. Basically, I have a master view controller with a table view. In order to populate the table view I need to call an API and download the information from there.

While downloading the data from the API, I would like to show an activity indicator in order to let a user know something is happening and the app is not stuck.

What I have done is I have a created a new UIView over the table view with alpha 0.5 and put an activity indicator in its middle. This is the code I execute when the master controller view loads:

// Show the activity indicator
self.overlayView = [[UIView alloc] init];
self.overlayView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
self.overlayView.frame = self.tableView.frame;
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
CGRect frame = self.overlayView.frame;
self.activityIndicator.center = CGPointMake(frame.size.width/2, frame.size.height/2);
[self.overlayView addSubview:self.activityIndicator];
[self.activityIndicator startAnimating];
[self.tableView addSubview:self.overlayView];

When the data is loaded from the API, I hide the overlay view and the activity indicator:

[self.activityIndicator removeFromSuperview];
[self.overlayView removeFromSuperview];

It is working fine but the problem is the overlay view is not aligned properly, it has a top margin and it is not looking good. Here’s how it looks:

enter image description here

  • 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-01T15:05:12+00:00Added an answer on June 1, 2026 at 3:05 pm

    Dont’t use

    self.overlayView.frame = self.tableView.frame;
    

    instead use

    self.overlayView.frame = self.tableView.bounds;
    

    It looks like your tableView has origin.y = 20.0f;


    Other notes

    • The designated initializer for UIView is initWithFrame: so you should be using that.

    • You can simply this

        self.activityIndicator.center = CGPointMake(frame.size.width/2, frame.size.height/2);
      

      to

        self.activityIndicator.center = self.overlayView.center;
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently using Xcode 4.2 and I have two view controllers (1 and 2). I
I use xcode 4 on Mac Os X snow leopard. I am trying to
I was developing an application using xcode 4 to target snow leopard (10.6) Now,
I had upgraded my OS into Snow Leopard, and I'm using Xcode 3.2 with
I'm developing an iphone app using PhoneGap 1.2.0 with Snow Leopard, Xcode 4.2 &
I'm designing my interface in Interface Builder (using Xcode 4.2 on Snow Leopard), and
I am using xcode with emacs. But everytime I start emacs, I need to
I'm using xcode and I was wondering if there was a way to view
I am trying to compile with javac on Snow Leopard through the command line.
I tried installing ruby 1.9.3 on Snow Leopard using: rvm install 1.9.3 --with-gcc=clang After

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.