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

  • Home
  • SEARCH
  • 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 8959043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:21:25+00:00 2026-06-15T15:21:25+00:00

I set the button background in the interface builder, but that wasn’t showing up

  • 0

I set the button background in the interface builder, but that wasn’t showing up so I set it programmatically. All (but one button… why?) shows on the simulator but never show on a device.

I get this output:

Could not load the "gray_button.png" image referenced from a nib in the bundle with identifier "com.example.ios"

This is the code:

- (void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    [self.getMyTripButton setBackgroundImage:[UIImage imageWithContentsOfFile:
                                          [[self getFullPathname] stringByAppendingPathComponent:@"images/gray_button.png"]]
                                forState:UIControlStateNormal];
    [self.popupButton setBackgroundImage:[UIImage imageWithContentsOfFile:
                                      [[self getFullPathname] stringByAppendingPathComponent:@"images/gray_button.png"]]
                            forState:UIControlStateNormal];


    [self.viewOurPackages reloadData];
}

I have also tried replacing imageWithContentsOfFile with imageNamed and both yield the same results.

I have added the images directory in my Project > Targets > Build Phases > Copy Bundle Resources, but I think this is where it all starts to go wrong and I can’t figure out why. Possibly because it’s a directory?

I would like to point out that I have double and triple checked that it is not a capitalization/case-sensitive issue.

UPDATE: I have solved the one button not showing. It would seem that real issue is that the images show on iOS6 and NOT on iOS5.

  • 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-15T15:21:26+00:00Added an answer on June 15, 2026 at 3:21 pm

    What worked for me was one (or a combination) of the following 3 things:

    1. Make sure your image file is formatted correctly. Sometimes png files need a little coercing. (I think this specifically was my problem)
    2. Make sure your button is of type Custom in the Interface Builder or UIButtonTypeCustom.
    3. If you are setting the image in Interface Builder and it’s still not showing, set it explicitly in the code using [button setBackgroundImage:image forState:UIControlStateNormal] (or [button setImage:image forState:UIControlStateNormal] depending on which one you need.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Android Button: set onClick background image change with XML? I need that
Let's look at this picture: The left arrow shows that the button background have
In Interface Builder, I have set the dataCell of one of the columns of
i have one button and i set button background style with LinearGradientBrush . everything
I have a button with some background color, but when I set this button
I have created a button in interface builder and set its type as custom.
Normally with Java Swing you can set the background color of a button with:
All right so I tried using the button set. So fair, I have been
I noticed that the height of a TToolButton increases when you set the button's
I do get that we easily can set the Close button text to a

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.