MultipleXib FileHow to SetIPoneProjectIPadThe platform is the content to be introduced in this article, mainly to resolve iPone projectIPadIf there are multipleXib FileWhat should I do? Let's take a look at how this article solves the problem.
1. First, the problem cannot be considered as complicated. This conversion is actually very simple.
2. Upgrade the iphone to the universal version.
3. In. plist, there should be the key of main nib file base name, corresponding to MainWindow, which is the entry of the iphone program;
At the same time, there will be the main nib file base name (iPad). If not, you can create one by yourself. The universal version will come out later and select it.) Then you need to create an xib file by yourself, as the iPad portal, for example, MainWindow-iPad
Tip: if you already have an iPhone xib file, open the xib file, and then file => Create iPad version (using autosizing masks) to generate an iPad untile. xib file, and then save it as your own name for iPad xib. Drag and join your project.
The above is to solve the program entry problem.
4. For other xib files, such as AController. xib,
First, use the above techniques to generate a AController-iPad.xib and add it to your project;
Find the class file AController. m,
- - (void)viewDidLoad
- {
- if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
- {
- [[NSBundlemainBundle] loadNibNamed:@"AController-iPad"owner:selfoptions:nil];
- }
- else
- {
- [[NSBundlemainBundle] loadNibNamed:@"AController"owner:selfoptions:nil];
- }
-
- [superviewDidLoad];
- //your other init code here
- }
Add the code in the red part, the loadNibNamed: according to the specific change.
5. For other internal code, if the iPhone and iPad versions are different, continue to use the above if judgment statement.
- if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
- {
- //iPad version code here
- }
- else
- {
- //iPhone/touch version code here
- }
6. We strongly recommend that you use the size instead of the specific number for the control position and size when writing a program. weight, size. write the statement like height, or open a separate head file to define it out, otherwise it will be very depressing to change the size one by one.
Iphone-> iPad changes are not difficult, but they must be careful.
For the moment, I only think so much. I will try again later.
Summary: there are multipleXib FileHow to SetIPoneProjectIPadThe content of the platform has been introduced. I hope this article will help you!