Basically to support iOS 7 and 8 you need to manually insert a “spacer” and then set them to be the same size
Once we can move to supporting only iOS 8 there are additional new constraint types we can expose that would remove the need for you to insert these spacers manually
The auto-layout is unnecessary difficult to work with. It would be much easier if Xojo supported relative screen width and screen height. And if it had ‘align’ properties. You would just drop a control on a view and then set it’s dimensions relative to the screen, align it to left, center or right.
For example: drop a Textfield and then set it to ‘20% of screen width’ and ‘10% of screen height’, align left.
It would then scale for all display resolutions that the different iOS devices have.
I’m not saying that it would be the only thing we need. The layout tool seems over engineered now. There are a lot of complex operations possible, but the basics are lacking.
For a control that is not placed on another yes.
Its “the containing view” - the parent view.
When you put one control on another (its parented in that control) then Parent refers to the parent control.
Thank’s Norman,
I have seen the Example with the Spacer’s but that’s not working for me.
The iOSTextFields have fixed Heights, so to distribute them equally over the Screen Height the Spacers must change
their size depending on the iPhone model you use.
I do not see a way to accomplish this with Auto-Layout.
For the moment my Workaround is to calculate the Height of all iOSTextFields, subtract it from Screen Height and divide the
result to one more than number of iOSTextFields and set the ‘offset’ of each Spacer with ‘iOSLayoutConstraint’
[quote=159432:@Hanspeter Stocker]Thank’s Norman,
I have seen the Example with the Spacer’s but that’s not working for me.
The iOSTextFields have fixed Heights, so to distribute them equally over the Screen Height the Spacers must change
their size depending on the iPhone model you use.
I do not see a way to accomplish this with Auto-Layout.
For the moment my Workaround is to calculate the Height of all iOSTextFields, subtract it from Screen Height and divide the
result to one more than number of iOSTextFields and set the ‘offset’ of each Spacer with ‘iOSLayoutConstraint’[/quote]
Simpler : for 5 textfields, make their to relative to the bottomLayoutGuide top, in percentage. The first one at 16%, the second one at 32%, up to 80% for the last one. They will space evenly whatever the size of the screen, even when rotating.
Maybe the Tic-Tac-Toe example would be helpful (Examples/iOS/App/TacTacToe)? It has 9 Canvas controls that are set to 30% of the width/height of the screen and everything remains properly aligned regardless of the iOS device or orientation.
Does anyone know of a website that explains (perhaps as a flowchart) the process flow the Xojo and or iOS goes thru to solve a series of Autolayout constraints? Every site I have looked at (hundreds) simply show examples and how “magic” they are, but nothing say “given this list of constrainst, you go thru this step by step process to determine the actual pixel/point answers that best satisify the criteria”… a flowchart would be excellent…
However that website is all messed up, broken links, missing images…
And “cassowary” is still “magic”… there are python and javascript versions, but both are compiled binary and still don’t document the “PROCESS”… I want to know HOW it works, not examples showing that it does work… I want to see “behind the curtain”
not that “this series of constrainst do this…” but “given this series of constrains, we went thru this steps, and this is how we arrived at the fact that ‘this series of constraints do this…’”
However that website is all messed up, broken links, missing images…
And “cassowary” is still “magic”… there are python and javascript versions, but both are compiled binary and still don’t document the “PROCESS”… I want to know HOW it works, not examples showing that it does work… I want to see “behind the curtain”
not that “this series of constrainst do this…” but “given this series of constrains, we went thru this steps, and this is how we arrived at the fact that ‘this series of constraints do this…’”[/quote]
Just an idea, but since we have access to the constraints values, would not logging all changes in a view when it opens show the order in which they take place, hence show the calculus process ? Or same after a resize ?
Sorry Norman… but I guess you are not understanding my question.
None of those videos show the “under the hood” implementation… they all show the “developer facing” interface.
they show WHAT it does, not HOW it does it
XOJO renders the button wide (from 20 on left to almost 80% across device)
XCODE
a) renders just right of CENTER of the device
b) button is as wide as the text (ie. 2/3 or less the size of XOJO button)
b) issues a warning that it is going to break the <=20 constraint
Am I doing something incorrect in how I am comparing? or do in fact the two pieces of code render different results but define the same constraints? if So… what is Xojo silently ignoring and why?
I just want to get a good understanding on how it works and why… and hard to do when comparing two things that I THINK should give same results, don’t
[quote=159642:@Dave S]Sorry Norman… but I guess you are not understanding my question.
None of those videos show the “under the hood” implementation… they all show the “developer facing” interface.
they show WHAT it does, not HOW it does it[/quote]
You’re right
Short of reverse engineering Apples code there is no open source reference implementation that apple has made available