Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom UIButton background image showing in iOS 6 but not iOS 5
    text
    copied!<p>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.</p> <p>I get this output:</p> <p><code>Could not load the "gray_button.png" image referenced from a nib in the bundle with identifier "com.example.ios"</code></p> <p>This is the code:</p> <pre><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]; } </code></pre> <p>I have also tried replacing <code>imageWithContentsOfFile</code> with <code>imageNamed</code> and both yield the same results.</p> <p>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?</p> <p><em>I would like to point out that I have double and triple checked that it is not a capitalization/case-sensitive issue.</em></p> <p><strong>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.</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload