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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:22:56+00:00 2026-06-11T06:22:56+00:00

I want a UIBarButtonItem with a custom image and blue text. I have made

  • 0

I want a UIBarButtonItem with a custom image and blue text. I have made this by creating a UIButton with the text, font colour and image first, and then setting a custom view for the UIBarButtonItem.

The problem is that when I disable the UIBarButtonItem the text goes back to white. I have no idea why.

UIButton *customButton = [UIButton buttonWithType:UIButtonTypeCustom];
[customButton setBackgroundImage:[UIImage imageNamed:@"images/ButtonHeader"] forState:UIControlStateNormal];
[customButton setTitle:myDynamicText forState:UIControlStateNormal];
[customButton setFrame:CGRectMake(0.0f, 0.0f, 70.0f, 44.0f)];
[customButton addTarget:myTarget action:myAction forControlEvents:UIControlEventTouchUpInside];
[customButton.titleLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:12.0f]];
[customButton.titleLabel setTextColor:[UIColor blueColor]];

UIBarButtonItem *customBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:customButton];

self.navigationBar.rightBarButtonItem = customBarButtonItem;
self.navigationBar.rightBarButtonItem.enabled = NO;

What I really want to do is have different text colour for enabled and disabled state, but I can figure that part out myself if someone can tell me why the text turns white when enabled=NO, and how to stop that.

  • 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-11T06:22:58+00:00Added an answer on June 11, 2026 at 6:22 am

    You shouldn’t be setting the font colour by getting the label like that. You need to configure it on the button

    [button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    

    UIControlStateNormal will act to set the default values, but then you can change the color for all the different states. A list of these states is available at the bottom of UIControl Class Reference under Control State

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

Sidebar

Related Questions

I have a UIBarButtonItem with a custom view of a UIbutton with an image,
I want to create a UIBarButtonItem with a custom image, but I don't want
I have an image that I want to display on a UIBarButtonItem, but for
I have a UIBarButtonItem with UIButton as custom view. The UIButton has a addTarget:action:
Ive put in a custom Back UIBarButtonItem, which is from an Image i made
I want to use custom barbutton that will have some image. I am doing
I have one image that I want to add as background image to uibutton.
I want to make a custom UIBarButtonItem to represent the Done button. I want
I have a custom bar button item that I want to nudge down 5
I have a custom UIButton as follows: UIButton * action = [UIButton buttonWithType:UIButtonTypeCustom]; [action

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.