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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:57:59+00:00 2026-06-14T15:57:59+00:00

help please. my code that change UIImageView is: – (void) viewDidLoad { background.image =

  • 0

help please. my code that change UIImageView is:

- (void) viewDidLoad {

background.image = [UIImage imageNamed:@"myImage.png"];

}

It works good on iPhone and also on iPad but, how can I change “myImage.png” to “myImageHD.png” when I will run this app on my iPad???? I just need to show myImageHD if my app will run on iPad. IT CAN BE DONE WITH XIB FILE, BUT I NEED WITH CODE TO FIX IT. To detect if app run on iPad, and show myImageHD. Thanks.

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

    Do this,

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
       background.image = [UIImage imageNamed:@"myImage.png"];
    } else { //UIUserInterfaceIdiomPad is for iPad
       background.image = [UIImage imageNamed:@"myImageHD.png"];
    }
    

    Another way to do this would be,

    if ([(NSString*)[UIDevice currentDevice].model isEqualToString:@"iPad"] } { //As per the below comment, for iPad simulator the string will be "iPad simulator"
        background.image = [UIImage imageNamed:@"myImageHD.png"];
    } else {
        background.image = [UIImage imageNamed:@"myImage.png"];
    } 
    

    UI_USER_INTERFACE_IDIOM() also can be used to check if the current device is iPad or iPhone. Instead of [[UIDevice currentDevice] userInterfaceIdiom] in the above if condition, you can use UI_USER_INTERFACE_IDIOM() also.

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

Sidebar

Related Questions

i am new in php i have a problem in my php code.please help
Please help me understand the following code snippet :- def any(l): whether any number
Please help me to rectify my code. Here I have described the code what
please help me to identify which of these following is more optimized code? for(int
Could you please help me converting this c++ code into python: I am trying
Could anyone please help me convert this code to vb.net, I have tried it
Could someone please help me with the code for below requirement or scenarios...I achieved
Hey friends any one please help me for this issue.in this javascript code i
the following code is not behaving like I would expect. Please help me understand
I'm relatively new to coding so please help me out here. The code will

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.