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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:27:53+00:00 2026-06-08T10:27:53+00:00

SOLVED: Check below for the solution to my problem. Hey SO, I’m having trouble

  • 0

SOLVED: Check below for the solution to my problem.

enter image description here

Hey SO,

I’m having trouble centering the UIActivityIndicator in the center of the view. As you can see here, it’s a little farther down vertically than it should be. What I have is a UIScrollView that later adds a UIImage subview. Before the UIImage loads though, I have this UIActivityIndicator to show that the image is loading.

- (void)viewDidLoad
{

    [super viewDidLoad];
    self.scrollView.backgroundColor = [UIColor blackColor];
    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc]       initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    spinner.center = self.view.center;

    [spinner startAnimating];
    [self.view addSubview:spinner];

Any ideas on how I could get the center CGPoint and set the UIActivityIndicator there? I’m not sure why self.view.center doesn’t work.

Thanks in advance.

EDIT: I had to account for the height of the navigation bar and the tab bar. The code I had to add was :

float navigationBarHeight = [[self.navigationController navigationBar] frame].size.height;
float tabBarHeight = [[[super tabBarController] tabBar] frame].size.height;
spinner.center = CGPointMake(self.view.frame.size.width / 2.0, (self.view.frame.size.height  - navigationBarHeight - tabBarHeight) / 2.0);

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-08T10:27:55+00:00Added an answer on June 8, 2026 at 10:27 am

    Two problems:

    1. First, self.view.center is the center of the current view’s frame on it’s parent’s frame. If you want the center of the current view, you want CGPointMake(self.view.frame.size.width / 2.0, self.view.frame.size.height / 2.0);

    2. Second, your current view does not include the navigationbar, so you’re centering it on the space of the screen below the nav bar. That will also make it look lower.

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

Sidebar

Related Questions

[SOLVED] See my answer below. I am trying to use stringstream (named ss) to
SOLVED - see Bish below I've got a list of checkboxes that all dump
The problem mentioned below has been solved and code has been changed to reflect
ANSWER: I wasn't clearing my ConnectionPools. The solved scenario is: SetUp: Check to see
I have to check memory performance of my application, I have solved Leaks now
SOLVED. Code has been edited to reflect solution. Given the following GridView : <asp:GridView
I looked at similar questions but I can't solve the problem. I have 2
PROBLEM SOLVED: I was overlooking a very simple issue, and that is that this
Below is a small test case that demonstrates a problem that I am trying
My problem is that I have to write code to check if a customers

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.