Need help: xcode 4 - simulation for iphone or ipad

Discussion in 'iOS Programming' started by newbie80, Mar 29, 2011.

  1. newbie80, Mar 29, 2011
    Last edited: Mar 30, 2011

    macrumors member

    Joined:
    Mar 2, 2011
    #1
    Hi,

    I'm new to xcode 4, I use my current project file xcode 3.1.3 and I open it in xcode 4 and run. My MainWindow.xib in Interface Builder is still iphone size, whereas I adjusted my other view in ipad size (1024 x 768). In my BUILD SETTINGS for my PROJECT and TARGET, I set the "Targeted Device Family" to iphone/ipad.

    When I run the ipad simulator, it looks good and fit into the ipad screen. But when I run it in iphone simulator, the screen doesn't fit in and also has been cropped by iphone view. I thought if you made the ipad size, and if you transfer to iphone, it will auto adjust?

    Or maybe I miss something in settings? Hope anyone could help me here. Thanks.
     
  2. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    Close.
    U need 2 seperate XIB files :)
    it won't autoresize, it will auto load the right XIB files according to what Device it's building on :)
    How to do that exactly, don't really have a clue, since i mostly have 2 different projects.
    But I think if u create a new universal project, u can check how they do it, and mimick that in your project, good luck :)
     
  3. thread starter macrumors member

    Joined:
    Mar 2, 2011
    #3
    Thanks jnoxx,
    I was pulling my hair out.
    Just now I tested two different files, one for iphone, one for ipad, and display on both devices also didn't show the auto sizing thing.

    Then I need to find out.
     
  4. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #4
    Well, your project doesn't automaticly knows, which XIB is for what device, that's what u need to find out ^_-
    And u clicked ur topic as resolved already?
     
  5. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    When you want to update a project for iPad you should use the Upgrade Target for Ipad menu item. That's in Xcode 3, not sure where it is in Xcode 4.

    It's quite possible to use a nib for both iPhone and iPad. It depends on the content of the nib. The nib's view will be resized when it's loaded based on the strings and strut settings for the top-level view.
     
  6. newbie80, Mar 30, 2011
    Last edited by a moderator: Mar 30, 2011

    thread starter macrumors member

    Joined:
    Mar 2, 2011
    #6
    I set it back to unresolved :p

    Hi PhoneyDeveloper,

    I tried to find the upgrade target for iPad menu item, but I couldn't find it on menu toolbar. Would you mind to tell me where is it? Thanks. :)
     

Share This Page