When I run iPhone app on iPad the screen resolution is wrong. How to fix this? - iphone

I encountered with a strange problem. I develop an application which is targeting iPhone device family with Retina 3.5 and 4. All the time I used iPhone 5 simulator to test all the UI and functionality and everything was good but know I have to test push notifications. I have iPad 4 (model MD522ZP/A) as an iOS 6 device. When I run my app on it all the UI layout became wrong. The most weird problem is when I tried to check display resolution with this code:
NSLog(#"RESOLUTION = %#", NSStringFromCGSize([UIScreen mainScreen].bounds.size));
I got this : RESOLUTION = {320, 480}. But it is iPhone 3 resolution! Why iPad didn't use Retina 3.5/4 resolution ? And how can I fix it? I don't want to create separate xibs only for iPad testing but I want to test my app on it so that all the UI elements will fit on screen.
Hope for the help.

It's not wrong. It is doing exactly the right thing. All references to sizes are in points, not pixels. When you get the bounds, it will be 320x480 on all 3.5" screens whether they are retina or not. Try it on any 3.5" retina device. You will get the same log output.
The iPad does not emulate a 4" device when running an iPhone-only app. It will always be a 3.5" iPhone compatible mode.
So seeing 320x480 is the correct size to expect.
Think of it this way. A retina iPad will show an iPhone-only app like it is running on a 3.5" retina iPhone. A non-retina iPad will show an iPhone-only app like it is running on a 3.5" non-retina iPhone.

Related

iPhone App truncating at bottom while running in iPad

I am developing an iPhone app which should support iPad (not compatible but with support for 1X and 2X option at bottom). My app supports iPhone 5,6 and 6 plus as expected, but when I run the app in an iPad some part of the screen is getting truncated at bottom. How do I fix this? It should show the full iPhone screen in iPad.
Make you app support iPhone 4s screen size. It seems that iPad runs iPhone app as in a 3.5 inch screen.

Iphone only app cuts of the bottom of the screen when viewed in Ipad mode (2x)

my app is very basic and looks great on the iphone but in compatability mode 2x on the ipad it does not show the same screen as on the iphone. it was built as an iphone only app and has no major graphs. this is what Apple told me. 2.10: iPhone apps must also run on iPad without modification, at iPhone resolution, and at 2X iPhone 3GS resolution
I've had the same behavior on a physical iPad 2 for an existing working iPhone-only app.
In fact, after adding for each Retina images (suffixed by #2x) a corresponding non-Retina version in the project, my app launched successfully on the iPad, without any modifications...
I'm not sure it will work for you, but might worth to try ?

Testing iPhone-only app on iPad without zooming?

My case is:
I am building an iPhone-only app.
My test devices are iPhone 4s and iPad 4.
I would like to support iPhone 5/5c/5s screen sizes, but I don't have the actual devices.
Can I use the iPad to test the UI for iPhone 5/5c/5s screen size, but without the automatic zoom of the app - simply taking only the 640×1136?
Thanks.
No, the iPad has not setting to allow this, neither did Apple release any API to do this.

How to turn on iPhone Retina in iOS Simulator?

I built and ran an iOS 4.3 app in Simulator. It initially brings up an iPhone 4 shell. Although all real iPhone 4s have retina display, this simulated iPhone 4 only has a resolution of 320x480.
I look in Hardware > Device. There's a checkmark next to the normal iPhone. So I'm using an iPhone 4 case but displaying normal iPhone resolution? I'm already confused!
iPad
✔ iPhone
iPhone (Retina)
I then switch over to iPhone (Retina). Strangely, it opens iPad with the same 320x480 resolution. Both the shell and the resolution are wrong here!
How am I supposed to turn Retina on and off and show it in the right shell?
iPhone (Retina) is the correct device to be choosing, but I'm not sure why Apple decided to use the iPad shell for that one. To enter 640x960 mode, go to Window > Scale and set it to 100%.
The iOS Simulator does indeed scale. I have no real reason to present on why it would choose the iPad shell, but the purpose of the scaling is to make sure it fits on your screen and stays (relatively) close to handset sizes. Be sure to check Window -> Scale and set it to whatever you find appropriate.

What is the difference between coordinate systems for iPad and iPhone?

I'm trying to make an application in cocos2d that can be used on multiple platforms (iPad, iPhone, iPod touch). Let's say I set a point to (360,160). The point would show up three fourths from the left and half way up the screen on the iPhone. Would it also do this on the ipad, or would I have to set the point to (768,384) to achieve this result? or does it stretch the screen. I figured I would have to, but am unsure because when I get the size of the screen during an iPhone OR iPad simulation, I always get 480x320 regardless.
Ignoring the iPhone 4 for the moment, the devices map their screens 1:1 with their coordinate spaces, so the iPhone has a coordinate space with size 320x480 (or 480x320 in landscape mode) while the iPad has a coordinate space with size 768x1024 (or 1024x768 in landscape mode.)
The iPhone 4, of course, quadruples the device pixels, but maintains an identical coordinate space to other iPhones and scales drawing to match the screen's resolution.
Note: if you get the same resolution running on the iPad Simulator it means you did not convert your project as an iPad project. Or you did not start it as a native iPad application but rather the iPhone App within the iPad Simulator.
Make sure you have gone through upgrading your target to iPad -> Xcode: Project menu, choose Upgrade Target for iPad
When running in the Simulator make sure you chose iPad Simulator as Active Executable.