Change the height of an iOSContainer

  1. 3 weeks ago

    Hi everyone,
    I'm quite new to Xojo and I have a problem with the usage of the iOSLayoutConstraint related to the height of an iOSContainer.
    I've created a iOSLayoutConstraint with the following code below:

    Dim dilcHeight As New iOSLayoutConstraint(self, _
    iOSLayoutConstraint.AttributeTypes.Height, _
    iOSLayoutConstraint.RelationTypes.Equal, _
    Self, _
    iOSLayoutConstraint.AttributeTypes.Height, _
    1, _
    containerHeight)
    self.AddConstraint(dilcHeight)

    where; Self = *myContainer*
    containerHeight = *integer value*

    This code is successfully compiled however the height of my container doesn't change.
    Why that? What I'm doing wrong?

    Thanks a lot for your help and sorry for bad English! :D

  2. last week
  3. Jeremie L

    Oct 10 Pre-Release Testers, Xojo Pro, XDC Speakers Europe (France) - getpackr.io
    Edited last week

    When creating the constraint your are referencing self to self and adding it to self.
    That won't work.

    To define the height of a container this should work:

    Dim Height As New iOSLayoutConstraint(ctrl, _ //ctrl is the iOSControl or iOSContainerControl
    iOSLayoutConstraint.AttributeTypes.Height, _ //Setting the height
    iOSLayoutConstraint.RelationTypes.Equal, _ //Defining as equal to something
    nil, _ 
    iOSLayoutConstraint.AttributeTypes.none, _ //None because the constraint isn't equal to another constraint
    1, aHeight) //aHeight is an Integer or Double
    parentView.AddConstraint(height) //parentView is the iOSControl or iOSView that is the parent of ctrl
  4. 4 days ago

or Sign Up to reply!