Auto-Layout frustrations :)

Dear all,

I am still new to this so maybe this is just a newbie question, but…

I am trying to make an IOS app that has a background that covers the entire screen, in this case called “Rectangle1” and has a solid color. I have then placed my controls on top of this and it looks pretty neat.

However, as soon as I change the screen size things go awry…

In my auto-layout i have the following settings:

Bottom=parent.bottom
Top=parent.top
Left=parent.left
Right=parent.right

There are no “offset” and “Scale” is 100 %

The result is very different on all seizes. Top and Bottom are correct on all sizes but sides vary from having a white edge to scaling 150 % to the right…

I have watched Paul Lefevres very good videos and read the documentation but I simply cannot get this to work as I expect.

Can someone please enlighten me and point me to a place that can explain this :slight_smile:

Thanks !

Greetings from Denmark
Kristian

Hi again,

I solved the issue with the white edges by changing the “Offset” to “Custom” with the value “0”… and now the layout looks fine on a 5.5 " iPhone but looks terrible on other sizes :slight_smile:

Although using a rectangle can be a solution, I would highly recommend using declares to achieve this.

This simple project has one function to change the background color of the view.
http://bit.ly/2FbpPtJ

I have been caught a couple of times by the constraint editor dafaulting to “Left” for the edge, even if i were editing the top constraint, etc.

<https://xojo.com/issue/45376>

Thanks Jeremie - it seems like the way to do it. However, i get a black background regardless of which hex code i put into your example. It seems as if you have put a red color into the excample, but it comes out black on my simulator. Can you maybe check if the method is correct? (It goes beyond my knowledge to do it myself, sorry)…

I use Mac OS 10.13.6 , Xcode 9 and Xojo 2018r1

Thanks again for your help.

Kristian

"Well over 1.5 years later, and this is still an issue. Seriously, if Xojo Inc wonder why people keep complaining about their iOS product, here is one simple little example. Why would I ever want the Top of, say, a Canvas to equal the Left of another control, such as a button? Yet that’s the default, every single time.

There’s no way this fix would require more than a few minutes of time, simply no way. All that has to be done is to change the selection in the popup menu to a more appropriate one."

I added some points to the case. Agree this should be a simple fix.

Seems the case is now implemented. Thanks Gavin, this fix will make Auto-Layout much smoother to work with.

Great. Thanks for understanding, Norman.