OK, so continuing my saga of learning how to apply iOS constraints…
Here’s what I want to do.
I want to dynamically create a number of say canvases.
I want the top of each canvas to be spaced relative to the top of the view and shifted by say 100 pixels * whatever the index of the canvas is going to be. So for example, the first canvas being index 0 would have it’s top at 0, the second at 100, the third at 200, etc.
So I have this constraint:
Dim ctop as New iOSLayoutConstraint(c, _
iOSLayoutConstraint.AttributeTypes.Top, _
iOSLayoutConstraint.RelationTypes.Equal, _
self, _
iOSLayoutConstraint.AttributeTypes.Top, i ,100.0)
But I was only drawing a single control. So I’m thinking about this and then it dawned on my that the Top of the view is always going to be 0. So if the value of “i” is always going to be multiplied by 0, then it’s always going to place every control 100 pixels down.
So instead, is something like this more appropriate?
Dim ctop as New iOSLayoutConstraint(c, _
iOSLayoutConstraint.AttributeTypes.Top, _
iOSLayoutConstraint.RelationTypes.Equal, _
self, _
iOSLayoutConstraint.AttributeTypes.Top, 1 ,100.0*i)
Or is there a better way to do this?