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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:42:29+00:00 2026-06-17T12:42:29+00:00

Apple docs have this to say: UIBarButtonSystemItemFlexibleSpace Blank space to add between other items.

  • 0

Apple docs have this to say:

UIBarButtonSystemItemFlexibleSpace
Blank space to add between other items. The space is distributed equally between the other items. Other item properties are ignored when this value is set.

That’s a little vague (exactly what space is distributed equally?) So I wrote a test method:

-(void) createToolbar {
    BOOL stuffInTopLeftCorner = NO;
    UIToolbar* bar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 1024, 44)];
    self.bar = bar;
    [self addSubview:bar];
    UILabel* titleLabel = [[UILabel alloc]initWithFrame:CGRectZero];
    titleLabel.text = @"Centered title";
    titleLabel.font = [UIFont systemFontOfSize:30];
    [titleLabel sizeToFit];
    CGSize titleSize = [titleLabel bounds].size;
    NSLog(@"titleSize is %g %g", titleSize.width, titleSize.height);
    UIBarButtonItem* titleItem = [[UIBarButtonItem alloc]initWithCustomView:titleLabel];
    UIBarButtonItem* flexibleSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    UILabel* leftLabel = [[UILabel alloc]initWithFrame:CGRectZero];
    leftLabel.text = @"Stuff in top left corner";
    leftLabel.font = [UIFont systemFontOfSize:30];
    [leftLabel sizeToFit];
    UIBarButtonItem* topLeftCornerItem = [[UIBarButtonItem alloc]initWithCustomView:leftLabel];
    NSMutableArray* items = [NSMutableArray arrayWithObjects: flexibleSpace, titleItem, flexibleSpace, nil];
    if (stuffInTopLeftCorner) {
        [items insertObject:topLeftCornerItem atIndex:0];
    }
    bar.items = items;
}

Here is what it looks like with the code as above:

enter image description here

And here is what it looks like if I change stuffInTopLeftCorner to YES:

enter image description here

It appears that adding something to the left of the title did not cause said title to move at all.

My question is — does that mean it will always center the title, regardless of what goes on either side of it?

  • 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-17T12:42:30+00:00Added an answer on June 17, 2026 at 12:42 pm

    As best I can tell, yes, it always centers the title, assuming that is possible.

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

Sidebar

Related Questions

Apple's docs say: Note: Because the amount of space available for the custom view
I have this question here (as well other quesrtions on SO), and the Apple
I have created a UITableViewCell using UITableViewCellStyleValue1, which the Apple docs define as: A
In the Apple Docs, they say that NSDateFormatter uses the Unicode for spec. I've
In the docs, Apple gives an example on how to add some hours and
MSDN docs say that only value types need boxing, but this does not apply
Say I have an NSManagedObject subclass called Item . Whenever an item instance is
I have been browsing the apple docs and stackoverflow for a while now, but
I've been reading loads of Apple docs and SO questions lately about this topic,
I can't find a clear description of these steps in Apple docs... I have

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.