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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:35:08+00:00 2026-05-27T00:35:08+00:00

I am trying to build an universal application with Xcode 4. However, it seems

  • 0

I am trying to build an universal application with Xcode 4. However, it seems a little different from past versions.

My project utilizes the View Based Application template. My issue is that I added a UIViewController subclass which has one nib file for iPad. How do I create another nib file with the same class targeted instead for iPhone? Also, how do I ensure that the proper nib file is loaded for the proper platform?

EDITED :
here is my code :

- (IBAction)BookView {

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        BookViewController *viewController = [[BookViewController alloc] initWithNibName:@"BookViewController" bundle:nil];
        [self presentModalViewController:viewController animated:YES];

    } else {

        BookViewController *viewController = [[BookViewController alloc] initWithNibName:@"BookViewController_iPad" bundle:nil];
        [self presentModalViewController:viewController animated:YES];
    }
}
  • 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-27T00:35:09+00:00Added an answer on May 27, 2026 at 12:35 am

    Step 1: Create for iPhone:

    • New file / ios / cocoa touch / UIViewController subclass
    • uncheck Targeted for iPad
    • check with XIB

    This step will create .m .h and .xib files with same name, for example: CustomView

    Step 2: Create new XIB for iPad:

    • New file / ios / user interface / view
      device family iPad
    • for convenience choose the same name with suffix _iPad (for example CustomView_iPad)
    • in this xib go to File’s Owner, in the inspector tabs choose identity inspector, custom class and choose the same name of class created in step 1.
    • Connect IBOutlets.

    In your code use something like this:

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        CustomView *viewController = [[CustomView alloc] initWithNibName:@"CustomView" bundle:nil];
    } else {
        CustomView *viewController = [[CustomView alloc] initWithNibName:@"CustomView_iPad" bundle:nil];
    }
    

    Good luck!

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

Sidebar

Related Questions

I am trying to build a Universal binary on MacOSX with g++. However, it
I have build cocoa application in 10.4.4 using (mac10.3.9sdk xcode version:2.2.1,universal binary), but when
I'm trying build a method which returns the shortest path from one node to
Trying to build a GUI application in Java/Swing. I'm mainly used to painting GUIs
I am trying to build MacOSX universal binaries (I need at least i386/ppc for
I am building a universal wrapper for several different external sites that would build
Im trying to build a little site using XML instead of a database. I
Hi all Working on a universal build for an iphone/ipod/ipad app. I was trying
I am trying to build a little sound generator with pygame and numpy. The
im trying to build a application or a method that goes through all of

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.