cannot get high resolution from ipad - ios

I am trying to set the screen resolution of a project to 2048x1536 (retina display on ipad).
I created a new single page app in Xcode using Swift, targeted ipad, set deployment target to various values (from 8 to 11), clicked Requires full screen, and chose only landscape modes.
I changed everywhere I could find in the storyboard, but no matter what I do, it is returning 1024x768. when I to an NSLog print from the ViewDidLoad function.
Can someone possibly shed some light on how to use the ipad to its best resolution?
Jerry

In Xcode the size of elements and the screen are measured in points. Each device has a scale factor that is applied to the points which means developers don't have to target specific screen sizes that have the same ratios.
Apple explain it a bit here:
https://developer.apple.com/library/archive/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/GraphicsDrawingOverview/GraphicsDrawingOverview.html#//apple_ref/doc/uid/TP40010156-CH14-SW7
Graphical representation here too: https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions

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.

Multiple screen resolution support in cocos2d v3?

I am little confused with cocos2d v3's support for multiple screen resolutions. If I use CCSetupScreenMode: CCScreenModeFlexible, what should be the default resolution of the image that I provide?
Currently, I have provided assets for all the iOS device resolutions along with suffixes and the correct images are loaded on iPhone "3.5inch" and iPad. However, the "-568h#2x" suffix for iPhone "4 inch" is not working fine. Am i using the wrong suffix?
I would like to avoid the need to use macros to determine which device the game is running on and load the images accordingly.
Thank you for your time!
The ScreenMode only defines if the screen scales up with the device size or not.
The fixed screen mode provides you with a stage that has a safe area and an unsafe area but the complete stage always has the same size.
In the flexible screen mode the root node of your scene will resize with the actual screen size, so you have to deal with dynamic sizing.
You can read more about the screen modes, image sizes and how to design a game for multiple screen resolutions in our tutorial.
In Cocos2D the suffixes are different from the ones UIKit uses. The suffixes are:
-ipad
-ipadhd
-hd
-iphone5hd

Touches are in retina resolution even though app is running in non-retina mode

I have an app targeting iPad2 (non-retina 1024x768 display). I don't explicitly enable retina mode, my scale-factor is set to 1 but touch events are reporting coordinates in retina mode i.e. the centre of the screen is (1024,768) and the corner is (2047,1535).
I thought the whole point was iPad apps would automatically work in non-retina mode unless you explicitly enable it by changing scale-factor.
I'm using a library which does some of the UIView creation, how can I obtain the main UIView and query it to see what's happening?
For retina testing, I am relying on the simulator only - I have 6.1. However another developer confirmed it wasn't responding to touches on his iPad3 device so I'm sure it's not a simulator problem.
I had opposite situation in my glkview app. I used screen->scale property to translate tap coords. So what you have is (as I suspect) is one of the following: (a) in your story board there is some property set for your view (inspect them all) (b) your device provides such layout (what iPad btw)?
Will later post more details.
There are some tech mistakes, perhaps You do not read carefully Apple documentation.
1) You cannot enable/disaber retina: retina is in HW and iOS can use it correctly, You can only use it. (in some circumstances you can adapt your code to device)
2) scale factor rarely should be used (read apple doscs) and only in specialized code related to custom drawing
3) in Apple vision generally You should NOT behave different in retina HW and non-retina.
4) Pixels and coords are LOGICAL coords, so bottom-ritght pixel is always at y= 1024 x=768.
4) You cannot have 2048 pixel resolution on a iPad2.
I don't know which library are You using, but STD behavior is different.

Xcode iPad resolution in landscape mode

I`m new at iOS development. I have seen that the new iPad 3 have an 1536x2048 resolution. And I asked from my designer that all the design should be in that resolution, but now i see that i have to resize every image, button and background to fit xcodes story board. How in xcode i can set the development resolution to 1536*2048?
You don't. Xcode uses points to reference pixels and automatically uses the correct graphics depending on the device. You have to make two copies of your image, "image" and "image#2x".
You do all of your development with "image" and iOS will automatically use the #2x version if the device is retina.
Your HD images should have #2x suffix. See "Specifying High-Resolution Images in iOS" section of Resource Programming Guide,
1536x2048 is the resolution of the screen (in pixel) but in xcode you are working with points. So ipad3 has still 1024x786 points (the same as in ipad2) but you can go to the point 0.5 for example.

Resources