iOSScrollableArea not scaling to different iOS devices

Last 2 hours I was struggling with the iOSScrollableArea.

  • I have a Containercontrol with one iOSTextField in to. The left of the iOSTextField is hooked to the Parent.CenterX
  • The iOSScrollableArea has the Containercontrol as content.
  • The iOSScrollableArea is locked to the left and right of the Parent.

If I now test this on several devices, the iOSScrollableArea is not scaled to the device View size. And of course, the iOSTextField isn’t either.
Basically the iOSTextField left side should always start in the middle of the view (according Auto-Layout settings)

Is this a bug or am I doing something wrong?

You forgot to constrain the ContainerControl to the width of the iOSScrollableArea

[code]
//Assuming the name of the iOSScrollableArea is “scroll”
//Place this code in the View open event or the Scroll open event
Dim cons As iOSLayoutConstraint
cons = new iOSLayoutConstraint(Scroll.content, _
iOSLayoutConstraint.AttributeTypes.width, _
iOSLayoutConstraint.RelationTypes.Equal, _
Scroll, iOSLayoutConstraint.AttributeTypes.Width, 1.0, 0)
cons.Active = True

self.AddConstraint(cons)[/code]

Thank you Jrmie. That did the trick.

Shouldn’t this be the default when using the iOSScrollableArea? Is this a bug in the Xojo Framework?

You might NOT want to have it constrain itself to that size for some UI’s

I understand but in most situation it should (9 out 10?). Maybe you could add a property for this?