iOS graphics need more than 72 dpi

In order to have columns in an iOSTable, pending the arrival of a real listbox at an indeterminate date, I have used the image property of iOSTableCellData.

The problem is that at 72 dpi, the characters appear blurry, since today all iOS devices are at least 144 dpi, and even 216 for some.

See attached project that contrasts the result between graphics at 72 dpi and fonts used in labels.

All devices use at least 144dpi, it is not the same as the Mac OS X world, where Retina support can be considered a luxury. With only 72 dpi, Xojo iOS is appearing really backward on iOS, and merits to support the standard resolution.

There are still some non retina devices that support iOS 7, though. So it would seem necessary to have a property that sets the graphics resolution.


I believe this is what the scale parameter of the iOSBitmap constructor is for.

Or just draw it twice as wide & twice as high

iOSGraphics and iOSPicture support this just fine. The trick is that you need to create your iOSPicture with the correct pixel dimensions and scale value.

I had not got that when I looked at the constructor. I redid my project with scale 2, and now the rendition is very close to regular fonts.

Thank you.

[quote=177693:@Michel Bujardet]I had not got that when I looked at the constructor. I redid my project with scale 2, and now the rendition is very close to regular fonts.

Thank you.[/quote]

When creating an iOSBitmap you intend to put on screen, you want your bitmap to have the same scale factor as the screen and the number of pixels in each dimension multiplied by the scale factor.

Now that I exprienced the “blurries”, I understand better some posts about the lack of Retina support in the IDE. I guess this will come eventually to Desktop ?

Something will come to the desktop, though not this exact API. The desktop is a bit more complicated in that a window can be moved between displays with different scale factors at runtime.

I did not think about that. Indeed it is an interesting case to see an additional standard monitor 72 dpi attached to a 144 dpi Retina MacBook. And a window seatting on both…

You do have a lot on your plate…

This solves a problem I’m having too. But…how do I determine the scale to use? Is there a way to determine the resolution of the device?

In a nutshell, all common devices today are 2x except the iPhone 6 Plus which is 3x.

Yep, got that. And I’ve got @2x and @3x images throughout my app. But what I mean is, how do I know within Xojo whether my user is on a 1x, 2x or 3x scale device?

There is an example on the Declare page of the docs that ought to tell the scale.

For iPhone, this is true. But iPad mini and iPad 2 are still pretty common and are 1x devices.

Thanks Paul, that seems to work for me. Maybe the scale should be an intrinsic property and/or the constructors with a scale parameter should default to the current scale because it seems so important to create iOSBitmaps/iOSGraphics at the right scale?

It seems like iOSView should have a scale property. If you’d like to see it added, please file a feature request.

That would be much simpler than having to use the declare.


@Paul Lefebvre while this code from the declare page of the docs returns the value of 2 in my iPhone 6 Simulator, on my actual iPhone 6 device it returns 0.

Is there a declare guru who might like to step up to take a look at this code? :slight_smile:

You need to have two declares, one which returns a single for 32 bit and another which returns a double for 64. Then use #if/#endif to select the correct one when compiling. This is why we need a float type :wink:

Thanks Jason! I should have remembered that, as I gave some points to that Feedback case ;). It’s all good now. :slight_smile:

Hi Paul,
The link to the declare page that shows the scale factor doesn’t show the info. It tried searching but couldn’t come up with it, can you help?