change size of iosContainerControl within Scrollable Area

I’m trying to dynamically change the size of an ioSContainer control that sits within an iosScrollable area - but I can’t seem to get it to change size. Here’s the method:

[code]Private Sub resize_ccs()
if cAdds = nil then
cAdds = ccAdds( sa1.Content ) //ccAdds is an ioscontainerControl subclass, sa1 is the scrollable area.
end if

if cc_width = nil then
cc_width = new iOSLayoutConstraint( cAdds, iOSLayoutConstraint.AttributeTypes.width, iOSLayoutConstraint.RelationTypes.Equal, nil, _
iOSLayoutConstraint.AttributeTypes.none, 1, 10)
end if

//width of cc is five times screen width (iWidth is calc property self.ContentSize.width)
cc_width.Offset = iWidth * 5 //<< This doesn’t work

//resize the cc’s within ccAdds
cAdds.resize_ccs(iWidth) //the resizing of ccs within the cc works fine.
End Sub
[/code]

The method is triggered by a change in screen orientation - but it seems to be stuck at the same size.

Here you go, James: I hope that this is helpful.

https://forum.xojo.com/34358-resize-scrollablearea-content/p1#p280612

Thanks Tom. Adding the constraint was the key (didn’t realise that was also necessary).

Slight variation in my code below - as it just changes the offset on the existing constraint, rather than removing and re-adding constraints each time.

[code]Private Sub resize_ccs()
if cAdds = nil then
cAdds = ccAdds( sa1.Content ) //ccAdds is an ioscontainerControl subclass
end if

if cc_width = nil then
cc_width = new iOSLayoutConstraint( cAdds, iOSLayoutConstraint.AttributeTypes.width, iOSLayoutConstraint.RelationTypes.Equal, nil, _
iOSLayoutConstraint.AttributeTypes.none, 1, 10)
self.AddConstraint(cc_width) //necessary to add the constraint to the current view.
end if

//width of cc is five times screen width (iWidth is calc property self.ContentSize.width)
cc_width.Offset = iWidth * 5

//resize the cc’s within ccAdds
cAdds.resize_ccs(iWidth)
End Sub
[/code]