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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:32:49+00:00 2026-05-27T15:32:49+00:00

I have a UIButton that is set in the XIB as 147 pixels wide

  • 0

I have a UIButton that is set in the XIB as 147 pixels wide and 30 high. It have a default text of ‘Navigation’. During the course of the application, I set the title to ‘Global’. Later, I then set it t0 ‘Summary’ and this display as ‘Su…ry’.

I have read so many things that say to set the default label for a UIButton to be longer than the longest text, however ‘Summary’ is shorter than ‘Navigation’. The text area seems to shrink during the application.

I do not reload the view. My application predominantly clears elements from a default display scrollview and refills with new data.

I have been using

button.titlelabel.text = @"Summary";

however I was getting occasions when this did not result in the text showing, so starting using

[button setTitle:@'Summary' forState:UIControlStateNormal];

Which worked every time.

Is there some way to force the text area within a UIButton to reset to the text being displayed? I would rather not create buttons on the fly, and if this is a function of objective-c, then I would consider this a fault.

Thanks in advance.
Chris H

  • 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-27T15:32:49+00:00Added an answer on May 27, 2026 at 3:32 pm

    It’s not a fault of Objective-C. Objective-C is a programming language. If anything is at fault it’s UIKit which is Apple’s UI framework for iOS.

    The problem is that your button won’t resize – that’s not how the API for UIButton has been designed. You can solve it by resizing the button yourself after setting the title. You can determine how big the text has to be with:

    CGSize requiredSize = [[button titleForState:UIControlStateNormal] sizeWithFont:button.titleLabel.font];
    

    Then you can use that to make it a bit bigger in width and height and set the frame of button to that.

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

Sidebar

Related Questions

I have an application where I initially set a UIButton's background image, and then
I have a UIButton that I want to resize to fit whatever text is
I have a set of UIButtons (defined in a xib) who have labels that
I have UIButton that I set the background image for three states, normal, highlighted,
Given that you have a method -(void)aSelector:(id)anyArgument; And have set up a UIButton programmatically
I have a UIButton that is created inside of each table cell. I want
I have a very simply subclass of UIButton that will fire off a custom
I have an app that uses a tableview, along with a UIButton that I
I have a method that accepts a sender and is called with a UIbutton.
I have an UIButton made with IB, it is set to Rounded Rect. At

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.