Code Monkey home page Code Monkey logo

Comments (8)

AnnieNinaJoyceV avatar AnnieNinaJoyceV commented on May 17, 2024

Any solution to this?

from stevia.

rayman-v avatar rayman-v commented on May 17, 2024

Not yet, I think this repo is not focus about vertical align problem, so I use another repo solute it when I need to custom specify constrain.

from stevia.

AnnieNinaJoyceV avatar AnnieNinaJoyceV commented on May 17, 2024

Do you mind sharing you fix? It will be very helpful.

from stevia.

damien-nd avatar damien-nd commented on May 17, 2024

For me what is what I do:

addConstraint(item: view2, attribute: . bottom, toItem: view1)

or for read you can add the default equal value like:

addConstraint(item: view2, attribute: . bottom, relatedBy: .equal, toItem: view1)

It is really easier to read and shorter than the default (but still works):

let c = NSLayoutConstraint(item: view2, attribute: .bottom, relatedBy: .equal, toItem: view1, attribute: .bottom, multiplier: 1.0, constant: 0.0)
addConstraint(c)

I hope it helps.

Le 7 oct. 2016 à 07:40, AnnieNinaJoyceV [email protected] a écrit :

Do you mind sharing you fix? It will be very helpful.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #61 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/ABxqpP-0wonDZIQ8dJXxSyZs4EOivP_Bks5qxdtNgaJpZM4KBXhW.

from stevia.

rayman-v avatar rayman-v commented on May 17, 2024

Using Cartography and Stevia to complement each other, I suggest.

from stevia.

s4cha avatar s4cha commented on May 17, 2024

@rayman-v Happy to announce that this use case is now simplified in latest version https://github.com/freshOS/Stevia/releases/tag/3.1.0

layout(
      0,
      |view1.size(100)
)

alignBottoms(view1-4-view2.size(40))
alignBottoms(view1, view2)

If you ever prefer the equation style (which is longer in my opinion in this case), you could also use :

view1.Bottom == view2.Bottom

Hope this helps, have a fantastic day !

PS: You suggested above using both carthography and Stevia, would you have examples of use cases that are not supported by Stevia ?

from stevia.

ChanchalW avatar ChanchalW commented on May 17, 2024

What if I want to keep view2 always in the bottom of view1. Not bottom align, if view1 height ends at 250 then view2 should have an origin.y on 251

from stevia.

s4cha avatar s4cha commented on May 17, 2024

@ChanchalW

There are many ways to stack two views together vertically.

Native Stackview

By using native UIStackView

Use Equation Api

view2.Top == view1.Bottom

Using layout

layout(
      view1,
      view2
)

You can find the full documentation here : https://github.com/freshOS/Stevia/wiki/2.-Layout

Let me know if this helps :)

from stevia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.