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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:37:29+00:00 2026-06-05T09:37:29+00:00

I wrote some codes in viewWillAppear in order to change the background image of

  • 0

I wrote some codes in viewWillAppear in order to change the background image of some buttons. It works fine in simulator. However, when I load it to a real device, it doesn’t work. The device is IOS5.1.1.

Any body knows what’s the problem?? Thanks!!

(void)viewWillAppear:(BOOL)animated
{

    [super viewWillAppear:animated];

    ...

    //set dataTypeSelect buttons background

    UIImage *tmpImage = [UIImage imageNamed:@"White.png"];

    [self.dataTypeSelectBut0 setBackgroundImage:tmpImage forState:UIControlStateNormal];

    [self.dataTypeSelectBut1 setBackgroundImage:tmpImage forState:UIControlStateNormal];

    [self.dataTypeSelectBut2 setBackgroundImage:tmpImage forState:UIControlStateNormal];

    tmpImage = [UIImage imageNamed:@"Cyan.png"];

    iTDLAppDelegate *tmpAppDelegate = (iTDLAppDelegate *)[[UIApplication sharedApplication] delegate];

    switch(tmpAppDelegate.viewingDataType)
    {
        case EnumDataType_HkHorse:
            [self.dataTypeSelectBut0 setBackgroundImage:tmpImage forState:UIControlStateNormal];
            break;
        case EnumDataType_S1:
            [self.dataTypeSelectBut1 setBackgroundImage:tmpImage forState:UIControlStateNormal];
            break;
        case EnumDataType_S2:
            [self.dataTypeSelectBut2 setBackgroundImage:tmpImage forState:UIControlStateNormal];
            break;
    }

    ...

}
  • 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-05T09:37:30+00:00Added an answer on June 5, 2026 at 9:37 am

    I have pinpointed it was caused by the image filenames.

    The file names are “White.PNG” and “Cyan.PNG”.

    My codes are as follows

    UIImage *tmpImage = [UIImage imageNamed:@"White.png"];
    UIImage *tmpImage = [UIImage imageNamed:@"Cyan.png"];
    

    They work fine in simulator but real device.

    I found the returned value of tmpImage is null in real device.

    Now I changed them to

    UIImage *tmpImage = [UIImage imageNamed:@"White.PNG"];
    UIImage *tmpImage = [UIImage imageNamed:@"Cyan.PNG"];
    

    They work fine for both now. 🙂

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

Sidebar

Related Questions

We wrote some code involving usort which works fine on our development systems (PHP
I wrote some codes so as to send e mail but I can only
I wrote some code that modifies the images on a webpage. Works with firefox
I wrote some code (about 100 lines) that is working fine on version 5.12.1.
I wrote some code to automatically track many objects through an 1000+ frame image
I have wrote some code in order to add 100 x 100 cells to
I wrote some codes in PHP to extract content of some elements from other
I want to show an image and wrote below codes $path = C:\xampp\htdocs\me\1.jpg; $image1
I wrote some java classes, to evaluate/demo different Sorting algorithms. However I got confused
I wrote some code to get the files in a directory. In order to

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.