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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:05:33+00:00 2026-05-27T06:05:33+00:00

So I have two buttons in the leftBarButtonItem. This is my code. NSString *todayString

  • 0

So I have two buttons in the leftBarButtonItem. This is my code.

NSString *todayString = @"...";
UIBarButtonItem *todayButton = [[[UIBarButtonItem alloc] initWithTitle:todayString style:UIBarButtonItemStyleBordered target:self.calendarController action:@selector(todaySelected)] autorelease];

NSString *weeklyString = @"...";
UIBarButtonItem *weeklyButton = [[[UIBarButtonItem alloc] initWithTitle:weeklyString style:UIBarButtonItemStyleBordered target:self action:@selector(weekSelected)] autorelease];
UIToolbar *toolbar = [[[UIToolbar alloc] init] autorelease];

[toolbar setItems:[NSArray arrayWithObjects:todayButton, weeklyButton, nil]];

self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:toolbar] autorelease];

The title of the buttons is dynamic. Sometimes the titles can get somewhat long. The buttons expand and look fine. However, if the titles get too long, it seems that the UIToolbar reaches some width maximum, as the buttons stop responding to taps at a certain X point. See image here

Green represents responds to touch and red does not respond to touch. The Today button responds to touch. The Weekly button, however, only responds to touch until the second “e”. Anything after that does not respond to touch.

I’ve been banging my head trying to fix this for a while, with no luck. I tried expanding the frame of both the UIToolbar and the leftBarButtonItem. Anyone know whats going on? Thanks in advance

  • 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-27T06:05:34+00:00Added an answer on May 27, 2026 at 6:05 am

    Your toolbar frame width is probably too narrow. In your code, you don’t even set its size, and rely on it to be sized it for you. Trying setting it to larger width, and make sure the autoresizingMask does not have `UIViewAutoresizingFlexibleWidth’ set.

    A good debugging technique is to set the background color of your new toolbar to something bright (to contrast against the toolbar you are installing it into) and watch its sizing to see how your button is being clipped interaction-wise.

    You may need to explicitly resize it as you update the bar button item titles if fixing it to a certain width is too restrictive for your app.

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

Sidebar

Related Questions

I have two buttons in a very simple app, this is my code when
I have two buttons on form, one of the buttons contain currency code (EUR,
In the code below I intend to have two buttons, and when each is
I am working with URLLoader and URLRequest in this case. I have two buttons.
I have two pages: Default.aspx and Target.aspx. On Default.aspx are two buttons: Button1 redirects
I have two buttons with the same ID: <button type=submit onclick=//do something id=theID>button 1</button>
I have two buttons in my flex app next to each other, ButtonA and
I have two buttons on my MVC form: <input name=submit type=submit id=submit value=Save />
I have two buttons 'btnPrev' and 'btnNext' What I want to do is to
I have two ListBoxes, lstAvailableColors and lstSelectedColors. Between each listbox are two buttons, Add

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.