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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:59:49+00:00 2026-06-08T11:59:49+00:00

I am implementing a footer view, which is a UIView and it has a

  • 0

I am implementing a footer view, which is a UIView and it has a label inside it. I wanted it so that the UILabel stays in the center all the time, but it just won’t. Here’s my code:

- (void)setupFooterView
{
    UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.scrollView_.frameWidth, kFooterViewHeight)];
    [footerView setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth];
    [footerView setBackgroundColor:[UIColor clearColor]];

    UILabel *loadMoreLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    [loadMoreLabel setBackgroundColor:[UIColor clearColor]];
    [loadMoreLabel setFont:[UIFont fontWithName:kProximaNova size:16]];
    [loadMoreLabel setTextColor:[UIColor whiteColor]];
    [loadMoreLabel setLineBreakMode:UILineBreakModeTailTruncation];
    CGSize desiredSize =  [[PNRConstants kLoadingMore] sizeWithFont:loadMoreLabel.font constrainedToSize:CGSizeMake(footerView.frameWidth, footerView.frameHeight) lineBreakMode:loadMoreLabel.lineBreakMode];
    [loadMoreLabel setFrameSize:desiredSize];
    [loadMoreLabel setCenter:CGPointMake(footerView.frameWidth/2, footerView.frameHeight/2)];
    self.loadingMoreLabel_ = loadMoreLabel;
    [footerView addSubview:self.loadingMoreLabel_];
    [loadMoreLabel release];

    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
    [spinner setBackgroundColor:[UIColor clearColor]];
    [spinner setFrameX:self.loadingMoreLabel_.frameX - spinner.frameWidth - 10];
    [spinner setFrameY:self.loadingMoreLabel_.frameY];
    self.spinner_ = spinner;
    [footerView addSubview:self.spinner_];
    [spinner release]; 

    [self.scrollView_ setFooterView_:footerView];
    [footerView release];
}

What am I doing wrong 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-08T11:59:50+00:00Added an answer on June 8, 2026 at 11:59 am
    [loadMoreLabel setCenter:CGPointMake(footerView.frameWidth/2, footerView.frameHeight/2)];
    

    The footerView.frameWidth/2 needs to be

    footerView.frameWidth/2 - loadMoreLabel.frame.size.width/2
    

    This is because the anchor of the label is in the top left corner instead of in the center. You subtract half the width of your label to account for this.

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

Sidebar

Related Questions

When implementing the Strategy Pattern, where does one put the code that determines which
I'm implementing a time entry web application and the UI has a very tricky
Implementing a custom membership provider, there are certain properties such as MinRequiredPasswordLength that only
Implementing Document-View pattern I faced the problem: standard generic collections and dictionaries ( List<T>
Implementing Ajax requests in my rails 3 app has been one of the most
Implementing a Thread by providing a new class that extends Thread and overriding its
Implementing a web service that uses Transport-level security with WCF over HTTP is pretty
I am implementing a webview based application, in that I tried to load an
Implementing custom DataAnnotationsModelMetadataProvider in ASP.NET MVC2. Assuming the object that is being rendered looks
When implementing SuperBoxSelect (http://www.sencha.com/forum/showthread.php?69307-3.x-Ext.ux.form.SuperBoxSelect), I've realized that it currently does not support shift +

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.