iOS Question iPad running iPhone App: which variant is safe ? [Ok]

igodese

Member
Licensed User
Hi all. I have a new App that uses the classical variant 320x568.
In the designer I arranged some scripts for every page that is loaded in the various conditions of the App.
All runs fine on iPhone 5s (native 320x568) and newer (375x667 and more).

The problem comes installing the App on iPad. The compiler is set to generate "iPhone only" App.

On Ipad, I see the screen cut-off at the lower part, even if the script claims to adjust the views.
Note that I have many (hidden, located at 100%x or 100%y) panels that come in-and-out of the page with animation.

I suspect that the real screen size (320x480, when you run iPhone native apps on iPad) isn't passed to the application, so any script continue to work with the default page format 320x568 and, obviously, all the animations, resizing and placements happens on a screen size that is bigger than the effective view.

My question is: if I add a new variant (it's a hard job, for multiple pages) with resolution 320x480, will such resolution effectively be used by the scripts when the App opens in compatibility mode on iPad ? Why such old (but evidently used) variant isn't set in the designer options ?

Am I doing this job in the correct / easier way or am I wasting time with a stupid / complicate approach ?

My "graphics guy" always asks to see his background images with the correct y/x, even if 568/320 is 1.775, while 480/320 is 1.5; so, must I double all the backgrounds images just to have my App running on iPad, that I don't need, nor want ?

Any help will be greatly appreciated, thanks.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I recommend you to avoid using multiple variants. It is simpler to use anchors and designer script to implement flexible layouts.

It is also a mistake to compile to iPhone only. Compile to both and if needed load the layout to a panel at the center of the screen (on iPads).

Note that I have many (hidden, located at 100%x or 100%y) panels that come in-and-out of the page with animation.
This means that you are not using the designer correctly. You should instead split the layout into several layout files and load them to the relevant panels.
 
Upvote 0

igodese

Member
Licensed User
Thank you, Erel, for your prompt answer.

My scripts are used in the same way the anchors work.

The problem is that I don't know how the Ipad "presents itself" to the App.
What's the native resolution when it runs an iPhone App in compatibility mode ?
It seems to be 320x480, but I don't know on what parameters the scripts will work, in that condition.

About resizing, the main problem are the background images that are "tailored" to a specific screen size.
If I resize them programmatically, the y/x ratio changes and the image is distorted.
The solution is to have different background images and to load the one that best fits the actual resolution.

In Android, any panel can have a background image that automatically resizes; in iOS you can do this with an imageview on a transparent panel.
I also tried using an image as "background color", but obviously there isn't any resize. You get, as background, just a part of the image that corresponds to the limits of the container.

I don't like too much to compile for both iPhone and iPad; it's another load of documents to send to Apple for publishing.
Consider that I absolutely don't want to run the App on iPad!

Anyway, I'll try such way as a last chance.
Thank you, again.
 
Upvote 0

igodese

Member
Licensed User
Thank you, Erel.

The FIT mode will leave some space at top or bottom (or right and left).
If I have a background image with a circle inside, such circle will transform in oval if resized in FILL mode or remain a circle in FIT mode, but with some space at the borders.
The problem, however, is just in iPad compatibility mode (320x480 ratio is 1.5); the other formats are all very near to ratio 1.775 and there is no problem to resize.
Circles are still circles and there are no empty areas at the borders.
If you want a full-screen background image that is good for 320x480 and for 320x528, you have to ask your graphic guy for 2 different images, designed for the different x/y ratios; or, you can resize (in-app or externally with graphic tools), but you will see "fat" characters, logos and so on.

I can't understand why the compatibility mode doesn't offers a "native" resolution of 320x528 or 375x667 !
Both of them can be easily placed "natively" at center of the iPad screen, that has a bigger resolution.
The actual way is a "compatibility mode" that is not compatible with newer iPhones, but only with the very first 3.5" devices!
Add to this that many and many developers doesn't want to create their apps for iPad ! Mah... Apple rules.

Anyway, at and of the games, I'm going to accept background images with empty borders or fatten logos, depending on the solution adopted.
I just hope that the App will not be rejected for such silly problems.

Thank you, as usual, for you precious help.
 
Upvote 0

aminoacid

Active Member
Licensed User
Longtime User
Can anyone recommend a simple example that shows an App that scales correctly on any iphone or ipad. Thanks! I too am pretty confused on this issue.
 
Upvote 0

aminoacid

Active Member
Licensed User
Longtime User
Actually, I found a good example at the following thread so it may not be necessary to start a new one.

https://www.b4x.com/android/forum/threads/autoscalerate-not-full-screen.73034/#post-464346

The "tbs_new1.zip" project posted by Klaus along with the associated discussion was of tremendous help getting to understand the use of Autoscale and Anchors rather than using multiple variants in designing the app for the various apple devices.

Thanks.
 
Upvote 0
Top