質問

I did a project few days back for iPhone but now i want to add iPad xib file into it. As features are enhancing. But the problem is that, at starting i selected an iPhone target for xib file not universal project.

So now i want to add xib for iPad's .

I created a new xib file for iPad but don't know how to load this on iPad instead of default xib file which is created for iPhone.

I have been checking a lot of other questions but didn't find any correct answer.Xcode 4 .xib Create iPad Version But its not working for me

I'm working on Xcode 5 and iOS 7.0.x

役に立ちましたか?

解決

For automatic loading xib for iPad add ~ipad to the name of xib file.
For example:
If name of xib for iPhone version is CustomVC.xib
then for iPad version use CustomVC~ipad.xib.
When you create object of vc CustomVC *vc = [[CustomVC alloc] init]; iOS will automatically choose correct xib file depending on platform (iPhone or iPad) where application is run.

他のヒント

  1. On the general tab for the target settings you'll find "Deployment Info"
  2. Change "Devices" to "Universal" (You've probably already done this) The first time you do this it should ask you if you want to copy the iPhone storyboard to create an iPad storyboard. Choose the correct answer.
  3. Select iPad from the tabs below devices.
  4. Change "Main Interface" to your new storyboard.
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top