Just a few days ago, I had to port one small application from iPhone to iPad. In general, everything went pretty painless, but there were a few rakes, which I did not fail to step on. Therefore, I would like to present some tips on porting mentioned above. The basis of
this small article, supplemented by some of my own tips and comments.
Tip one: nib files.
Follow Apple's advice and start porting your application with the menu item β
Upgrade Current Target for iPad ... β, which you can easily find in the context menu (right mouse button if someone is not up to date) of the current target (
Target ) in Xcode. Thus, all your user interface nib files will be duplicated in the β
Resources-iPad β folder, and the postfix β
-iPad β will be added to the name of each file.
The next step is to process your newly created nib files in such a way that they look great on the spacious XGA Apple Tablet screen. At this stage, you have, so to speak, two options. The first option is to open each nib file in
Interface Builder and in the
File menu select the item β
Create iPad Version β. Personally, I did so and, in general, achieved the desired result. However, on the Internet, one more way is recommended: in each of the nibs, set attributes as follows:
')
Here I ask to pay attention to the tick "
Autoresize Subviews ", it is, as the name implies, is responsible for this particular element UI (
View ) for the automatic resizing of all its children. This option allows you to change the size of the entire, so to speak, hierarchy of elements only by changing the size of the element (
View ) at the top level.
In addition, it is recommended to immediately check the settings for the size and location of your views (
View ), since, if up to the present moment you only focused on screens of 320x480, most likely these settings will be set incorrectly.
Tip two: controller classes.
In your controller classes, you will probably need to dynamically resize your user interface elements. Here the following conditional compilation will come to your aid:
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
// , iPad
#else
// β iPhone OS , 3.2
#endif
In addition, in SDK 3.2 a remarkable property appeared in the
UIDevice class
- userInterIudiom (of type
UIUserInterfaceIdiom ). The type definition is as follows:
typedef enum {
UIUserInterfaceIdiomPhone,
UIUserInterfaceIdiomPad,
} UIUserInterfaceIdiom;
To the naked eye, you can see that by checking the value of this property (
property ), you can easily find out whether we should use the iPad or iPhone-type interface on a particular device.
Tip Three: Targets.
On the same Internet sites, it is recommended to decide in advance on which devices your application is supposed to work: iPhone, iPad, or both. This setting can be explicitly specified in the Info.plist file, but it is recommended to inform the compiler about your choice less explicitly by selecting the β
Build β tab and the β
Targeted Device Family β option in the project properties.
In the "
Base SDK " you need to specify "
iPhone Device 3.2 ", even if you want to support only iPad. It sounds, of course, a bit strange (the iPhone is still at 3.1.3), but this is exactly the point that you need. In any case, there is still such a wonderful option β
iPhone OS Deployment Target β, which allows differentiating the devices on which the application is supposed to work: specify the version of OS 3.2 to support only iPad, and version to support iPhone
and iPad "3.1.3".
Tip Four: submit.
Anyway, you will almost certainly encounter some typical errors when trying to add your application to the AppStore. Here they are!
The binary you uploaded was invalid. The bundle did not contain an icon for iPhone and iPod of exactly 57x57 pixels, in .png format.
Alternatively,
iTunes Connect can also signal to you that you do not have an 72x72 icon specifically for the iPad. The fact is that now you must provide both icons for both types of devices. And since XCode copies all bundle resources into one root, so to speak, βnamespaceβ, the names of these two resources (icons for iPhone and icons for iPad) should be different. Personally, I recommend calling the icon for the tablet by analogy with the other resources β
icon-iPad.png β. After that, in the Info.plist file you must specify the name of the file of the larger icon, that is, in our case, β
icon-iPad.png β.
The binary you uploaded was invalid. The bundle identifier is already in use by a different software package.
Remember: even if your iPhone-portable application only works on iPad tablets, you should change the
bundle identifier to avoid name conflicts with the current iPhone application.
In addition, I met a description of such an error:
Your binary indicates support for iPhone/iPod touch. You must provide an iPhone/iPod touch screenshot.
And the error also occurred among those who downloaded the application, labeled as βiPad-onlyβ. Perhaps the answer lies in the fact that the β
Target device β setting in the Info.plist file was not correctly checked. Most likely, now the bug is already fixed.
Tip Five: Screenshots
And of course, do not forget to add screenshots to the new version of your application that supports Apple tablets, and iTunes Connect will be signaled about this right after a successful download. Remember, screenshots need to be added for each localization!
Tip Six: Orientation
Here, of course, refers to the orientation of the UI, depending on the position of the device - portrait and landscape. The fact is that with the release of the tablet, Apple has somewhat tightened the requirements for compliance with its recommendations (iPad Human Interface Guidelines), and now, if you, for example, wish to update your application without taking care of its work in all possible orientations, Apple strongly recommends you add this opportunity.
Results
Well, I hope all the above tips will save you some time. Good porting!