How alignement two elements with contraints?

后端 未结 2 571
甜味超标
甜味超标 2021-01-28 07:24

i want alignement two elements, one in the center and the other in right side

a.WidthAnchor.ConstraintEqualTo(25).Active = true;
            a.HeightAnchor.Const         


        
2条回答
  •  佛祖请我去吃肉
    2021-01-28 07:51

    we have 3 views here: container view, bigger view, smaller view.
    1. set bigger view's centerX,Y constraints equal to container view's centerX,Y constraints.
    2. set smaller view's centerY constraint equal to container view's centerY.
    3. set smaller view's right anchor equal to container view's right anchor with offset -8 (or whatever you want) Hope it helps.

提交回复
热议问题