Constraints programmatically

Is it necessary to use “setTranslatesAutoresizingMaskIntoConstraints” in Xojo?

Let me ask what it is your doing that you think you might need this ?

As that could influence whether or not you need this
Xojo controls dont require this

I need to set constraints programmatically and have read this (not Xojo but Swift resp. Objective C):

“When adding views to a layout in code the toolkit will, by default, attempt to convert the autosizing mask for that view to Auto Layout constraints. Unfortunately those auto-generated constraints will conflict with any constraints added within the application code. It is essential, therefore, that translation be turned off for views to which constraints are to be added in code. This is achieved by calling the setTranslatesAutoresizingMaskIntoConstraints method of the target view, passing through false as an argument. For example, the following code creates a new Button view, turns off translation and then adds it to the parent view: …”

Would that have anything to do with what is described in namely name constraints for controls added programmatically ?

@Norman Palardy Are Controls from iOSKit etc. Xojo Controls? Probably not.
Is is a problem to use it with Xojo Controls?

I dont know about IOSKit based controls
Haven’t investigated

but if you’re adding iOSLayoutConstraints (not NSLAyoutConstraints) then I do not believe you need to do anything with the translation (in fact without declares you cant)

Hi Jens, the controls in iOSKit use the iOSUserControl class provided by Xojo so they can be treated like other Xojo controls (iOSLabel, etc) in regards to autolayout and similar control interactions and should pose no problems.

@Jason King Thank you very much for giving the information and thanks for the information itself.

You’re welcome, glad I could help.