I have a program for iPhone and programmer actually finished its work on it, so I should convert the program for iPad on my own. Considering my very limiting skills, it seemed to be difficult task, however, I had some success with xibs (they look OK on iPad simulator). Sad to say, all the programmable elements like buttons, labels and custom images are placed at the iPhone-coded positions, so it looks terrible. How can I convert the positions of these elements to iPad-compatible ones? Should they be "hard-coded" (i.e. x=45. y=23) or I can use some relative coordinates. Any help, links, tutorials - welcome (looked for them in google with no success).
2 Answers
it seemed to be difficult task, however, I had some success with xibs (they look OK on iPad simulator)
xib are the first steps, than the .m files.
Sad to say, all the programmable elements like buttons, labels and custom images are placed at the iPhone-coded positions
They are hardcoded into source like : [button setFrame:CGRectMake(320, 0, 100,100 )];
How can I convert the positions of these elements to iPad-compatible ones?
You have to check which is running now: iPhone or iPad. Here is how. If iphone let be the old code, if iPad close yur eyes and do math in order to get the new coordinates.
I hope it helps somebody!

- 1
- 1
-
thanks, actually the converted app is not for iPhone, but for iPad alone (so, there are 2 different apps - 1 for iPhone, the second one - for iPad... – Ilan Aug 13 '13 at 21:38
You'll need to reposition them yourself to the correct locations on the iPad. Since the iPad has a different aspect ratio from the iPhone (and even the iPhone 5 differs from other iPhones) there isn't any simple way to just scale the iPhone positions to fit the iPad.
Should they be "hard-coded" (i.e. x=45. y=23) or I can use some relative coordinates.
It really depends on the particular situation. For example if it was something like a title label that you want centered, then it makes sense to use relative locations. So its up to you to determine whether an element has something that it should logically be relative to. Of course you can hardcode everything, but relative positions may make it less work to reposition if in the future you need to change positions.

- 451
- 4
- 8