Dynamically load nib for iPhone/iPad within view controller

前端 未结 5 2086
悲哀的现实
悲哀的现实 2020-12-24 13:30

I have converted an iPhone application using the wizard like thing in XCode into a universal app.

It builds fine but obviously looks a bit rubbish in some areas :)<

5条回答
  •  一整个雨季
    2020-12-24 14:25

    Actually, Apple does all this automatically, just name your NIB files:

    MyViewController~iphone.xib // iPhone
    MyViewController~ipad.xib // iPad
    

    and load your view controller with the smallest amount of code:

    [[MyViewController alloc] initWithNibName:nil bundle:nil]; // Apple will take care of everything
    

提交回复
热议问题