iPad to iPhone image size/layout confusion
I've written an application for the iPad that I'd now like to 开发者_Go百科get working on the iPhone (a universal application).
At the moment it runs in the iPhone simulator, but the UIKit elements are positioned using pixel positions - so a lot of them are offscreen. Additionally my UIImages are too big, and need to be scaled to fit the iPhone. How do I go about doing this?
Thanks in advance.
Some more information: If I position a UIImageView using UIBuilder, the image displayed takes up the same ratio of the screen if displayed on the iPad or iPhone. Which is what I want, however I need to do it programatically.
If I create a UIImageView programmatically it will take up a much larger ratio of the screen on the iPhone compared to the iPad.
Edit: My nib is actually empty apart from a OpenGL view. The OpenGL view is scaling fine. I do create a few UIKit controls programmatically and this is where the problem is happening.
Probably the easiest way: make two separate xibs (1 for iPad, 1 for iPhone). Start a new universal project and migrate the curent one into it, it'll take some time, but it'll save you a lot of headaches.
精彩评论