iOS Question 100%x 100%y weirdness

sorex

Expert
Licensed User
Hello,

I have an iPhone 4s when I look up the specs I see that it should be 640x960.

When I do a log(100%X) it prints 320 to the log, log(100%y) prints 480.

What am I missing here?
 

Hugh Thomas

Member
Licensed User
I'm getting some odd results from 100%x and 100%y. I've read the section on coordinates but it doesn't explain what I'm seeing.

The following piece of code:
B4X:
Public NavControl As NavigationController
Private pPopup As Page

pPopup.Initialize("Popup")
NavControl.Initialize ("")

App.KeyController = NavControl
NavControl.ShowPage(pPopup)
Log ("pPopup.rootpanel, width=" & pPopup.RootPanel.Width & ", height=" & pPopup.RootPanel.Height)
Log ("100%x=" & 100%x & ", 100%y=" & 100%y)
results in the following log entries:

B4X:
pPopup.rootpanel, width=320, height=504
100%x=320, 100%y=89
why is 100%y returning 89?

This is running on an iPhone 5.

I don't know if it's relevant, but before these calls I was using a TabControl to manage some other pages, but I expected assigning App.KeyController = NavControl would mean the pages that I display now would be unaffected by what went before in the TabControl.

Thanks,

Hugh
 
Last edited:

billyrudi

Active Member
Licensed User
try to use this
B4X:
Dim LV As LayoutValues = GetDeviceLayoutValues
Page1.RootPanel.AddView(gmap, 0, 0, LV.Width,   LV.Height)
 

Hugh Thomas

Member
Licensed User
Thanks for the suggestion. Does this get the layout values for the currently displayed page (i.e. taking into account space taken up by the TabControl etc)?

As this problem only affected one routine, which was being passed the rootpanel of the page it was to display on, I ended up getting the width/height of the rootpanel and using that. Another in the long line of hurdles to jump in porting my app to iOS ;^)

Hugh
 

jazzzzzzz

Active Member
Licensed User
my app only works in portrait ,and page resize will be called just once so how can i responsibly create views in different pages?? without using %x and %y
 
Top