iOS Question Scrollview and AutoScaleAll

JonPM

Well-Known Member
Licensed User
Longtime User
I'm having some frustrations using AutoScaleAll in the Designer along with a scrollview. Please see attached example.

I would like the views on layout2 to AutoScale, however the size of Scrollview1.ContentHeight is incorrect in the pg resize event, causing the panel to be cut off.
Commenting out AutoScaleAll in layout2 will load the correct height, but obviously views aren't scaled.

How do you use a layout with autoscale and scrollview together?
 

Attachments

  • scvtest.zip
    3.3 KB · Views: 333

Erel

B4X founder
Staff member
Licensed User
Longtime User
The correct way to implement it is with a tall variant and a panel that is anchored to both sides:

SS-2015-12-09_09.47.26.png


The code in Page_Resize:
B4X:
Private Sub Page1_Resize(Width As Int, Height As Int)
   ScrollView1.ContentWidth = Width
   ScrollView1.ContentHeight = 800 'set the content to be whatever size you like. The anchors will take care of handling the panel size.
End Sub

While going over your project I found a bug in AutoScaleAll related to large containers. For now it is better not to use AutoScaleAll in the second layout. This bug is fixed for the next version.
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
Thanks Erel. Will my project in the first post work as is once the bug is corrected in the next version?
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
The problem with using anchors on Panel1 is that the ContentHeight of the scrollview determines Panel1's height, which is backward. I have a fixed height for Panel1, that then gets autoscaled. Now I want the ContentHeight to be set to Panel1's new height. I'm not having luck achieving this. Advice?
 
Upvote 0
Top