iPad2 vs iPad3 manually positioned items changing? - ios

since the iPad 3("The New iPad") has twice the pixels I obliviously have my make any images twice as big. But my question is since it has twice the pixels if I am manually placing an object on screen, with say CGRectMake, will it appear in different places on the iPad2 from the iPad3?
say I'm using the code below to position a button on screen:
CGRectMake(375,500,125,125);
since its positioned at 375 pixels on the X coordinate wouldn't it appear in different places on the iPad 2 vs the iPad3 since the iPad3 has twice as many pixels?
I'm sure this is a dumb question that any mildly experienced iOS developer would laugh at but since a simple Google search didn't turn anything up I figured id ask.
Thanks!
-Shredder2794

Though the amount of pixels may differ among devices, Core Graphic's coordinate system does not. This is because CG expresses itself in points, not pixels.

Related

Is the iOS coordinate system equal across devices?

I've been working through tutorials in order to get the hang of using auto layout. I'd like to start designing more interfaces in code versus using the basic options available in storyboard. However, before I explore this idea, I'd like know if the iOS coordinate system is equal across all devices?
I know that most of the latest and greatest iOS devices have improved retina displays but I'm not sure if that affects the coordinate system.
If the above is true then a second part to this question would be what x and y values can I go up to in the coordinate system before the view is no longer visible?
Obviously different sized devices have different sized screens. The old 3.5" iOS devices were 320x480 points. Then the 4" device were 320x568. And of course all the newer devices are bigger yet. Most iPads are 768x1024 but then there is the iPad Pro, etc.
And there is the difference between points and pixels. Only worry about points. This hides whether the device is the old non-retina, 2x retina, or 3x retina.
But none of this is relevant. You don't need to know any of these sizes. That's the whole point of autolayout and constraints. Even with code, you don't need to know absolute sizes. Ask a view its size. Make decisions based on that size. Apply layout based on the size at runtime without any hard coded knowledge of screen sizes.

Making a ruler functionality within the app, but different screen sizes?

I'm working on a project which particularly in this ViewController, I have set up a scale as a UIImageView and it needs to react on touch events based on that scale and to produce some output. However, my question is, how to implement accuracy for all of the different devices? I was thinking to try with if else statements for every single device (iPhone 4,5,6) and assign the properties based on those conditions. But that would be like dirty coding, or no? Is there any other method for this type of functionality? I need you to give me some opinions or tips just to put me on the right track. Thanks
You can use UIScreen's scale property to determine if the device has a retina screen (#2x or #3x), which will help to some extent. At present, every iPhone has the same number of points per inch (163), with differing numbers of pixels per inch depending on the device. The iPads are a different matter, though, as the iPad Mini has the same point density as an iPhone, but the 9.7" iPad and the iPad Pro have a lower density. I think for the iPads you'll need to detect the specific device to be able to figure out the physical screen size.

Scene seems to display four times larger when running simulator with retina dispay

I am testing my app in the iphone simulator To test the retina display, I've set the hardware to iphone(retina)
Unfortunately, the entire scene seems to be scaled to four times its normal size!
The only thing I see, is the left bottom quarter of the entire scene.
The app, since it exceeds the bounds of the screen, shows up only as a quarter on the iphone screen.
I am using Cocos2d. What is the cause of this? I also have retina display enabled in the app delegate. Any help is greatly appreciated!
The simulator is increasing to four times it's normal size (twice on each axis) because by default it uses a 1:1 mapping of pixels.
In other words, one screen pixel = one device pixel. So when you go to Retina display, which doubles the retina density, you need four times as much space to display the device screen.
Edit:
In response to the updated question, you can use the 'scale' feature. Window->scale->50% (or command+3).

Choppy Animation and Scrolling Performance on "New iPad" (Retina iPad 3)

I've been working on an iPad app that has gone through fairly extensive testing on the iPad 2. I recently obtained a "New iPad" (iPad 3), and the app feels significantly slower. Animations / scolling behaviors that were silky smooth in the iPad 2 now feel extremely stuttery on the new iPad.
I do a lot of the standard UI performance tips: using shadowPaths, drawing UITableViewCells using CoreGraphics, rasterizing views that don't change often / don't need to animate.
Are there any pitfalls I should watch be watching out for in transitioning my app to the iPad 3?
Update
I swore that I tried this before but removing rounded corners from my UIViews views ended up speeding the app significantly. clipToBounds also seems to be a significant performance hit (although strangely... setting a view's layer's maskToBounds seems to be okay, which makes no sense to me). Some combination of this and other tweaks seems to have resolved the issue.
Once I do a second visual pass over the app, I'll figure out a way to reimplement rounded corners in a more performant way.
4x the pixels, only 2x the fill rate. The maths says it all.
I think that the biggest thing to watch out for is copies of graphics from system memory to the video card since they are 4X larger than previous iPad graphics with about the same CPU power as the iPad 2.
Maybe it's due to upscaling by iOS? After all it has to calculate a higher res version of everything before showing to screen. Since some things on the screen are hi-res already (font and default ui elements) it has to scale every other element individually.
Have you tried just scaling the images yourself and adding them as retina images to your project?
Good luck.

Printers' points vs. iOS points

When programming for the iPad, font (and other) sizes are specified in "points." I have seen reference to a point as a pixel that is independent of screen resolution. But I am having trouble finding definite confirmation of how big a point is in real terms (that is, in terms of inches). Is a point equal to one pixel on the standard iPad screen, so 1pt = 1/132in? And then, to confirm, this means that an "iOS point" is a different unit than the printer's point = 1/72in?
Thanks.
See here and here (scroll down to points vs. pixels) for the official word. Basically, a point is one pixel on a non-retina device (so the size varies between the iPad and the iPhone - it isn't related to a printer's point) and 2 pixels on a retina device (which has twice the number of pixels in each direction).
Drawing and positioning is done in points to allow the same code to run on both types of device - the frameworks will fill in the gaps to make drawing smoother on retina devices.
An iPad point is different to an iPhone point, which is different to a printers point, to answer your question.

Resources