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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:14:36+00:00 2026-05-16T22:14:36+00:00

HI all, In xcode I am trying to load different nib file in case

  • 0

HI all,

In xcode I am trying to load different nib file in case I am using iphone/ipod or ipad.

I have a Define.h file with all enum and constants in it, so I would like to put in there a kind of (obviously wrong because I don’t know how to do it):

#if IPHONE  // <-- can I intercept the Active Executable here ?
  #define MY_VIEW @"TableViewIphone.xib"
#else
  #define MY_VIEW @"TableViewIpod.xib"
#endif 

Then in my view controllers which include Define.h

[[NSBundle mainBundle] loadNibNamed:MY_VIEW owner:self options:nil];

I am in need of doing this with device simulator, is there a way to intercept what’s in “Active Executable” in xcode and have a specialized set of define ? Are there any other and easier alternatives ?

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-05-16T22:14:37+00:00Added an answer on May 16, 2026 at 10:14 pm

    What you want to do is select a xib at run-time, appropriate for the device.

    What you are doing is a compile-time selection, which will set the xib to be used for all devices, which is not what you want.

    I’m assuming you’re building a Universal app, yes?

    I prefer to have the device load the appropriate xib when my app is launched by using the proper key in my app’s Info.plist file, which is the key NSMainNibFile~ipad. (e.g. I set NSMainNibFile~ipad to MainWindow-iPad… note: no “.xib” bit)

    Another alternative is to use the UI_USER_INTERFACE_IDIOM macro:

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        // Load iPad xib
    }
    else
    {
        // Load iPhone xib
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to get my xCode to contain all iPhone sdk's from 4 back
I am trying to run an application in xcode 4.2 to IPhone 4.3.3. All
I am trying to test my app on an ipod (4.2.1) using xcode 4.
I am trying to program an app for the Iphone using Xcode 4.3.1, and
Hey all. I'm really new at this obj-c/xcode stuff. I'm trying to load the
I'm trying to play with AppleScript to compile all my Xcode projects. I'm using
I am trying to create a static library in Xcode using C++ ( All
I run Xcode 4.3 on a Mac 10.7.4 (Lion). I have all my resources
After updating to XCode 4.3, all my archives built using XCode 4.2 are gone.
I have downloaded the latest varsion of Xcode. All the tutorials i see for

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.