Giter Club home page Giter Club logo

Comments (8)

raylillywhite avatar raylillywhite commented on July 22, 2024 1

Oh, awesome. Nice find! Even with the casting, that's much cleaner than having to step outside masonry to create the constraint :)

In case someone finds this issue via search, here's the relevant part of the example:

[topView makeConstraints:^(MASConstraintMaker *make) {
    UIView *topLayoutGuide = (id)self.topLayoutGuide;
    make.top.equalTo(topLayoutGuide.bottom);
    make.left.equalTo(self.view);
    make.right.equalTo(self.view);
    make.height.equalTo(@40);
}];

Thanks @cloudkite! Feel free to close this issue. (I'm just leaving it open in case you wanted to track any additional changes you might make)

from masonry.

cloudkite avatar cloudkite commented on July 22, 2024

It was on the todo list, thanks for reminding me! I'll have a think and come back with some suggestions. In meantime I need to fix the tests as they no longer run due to the travis upgrade.

from masonry.

cloudkite avatar cloudkite commented on July 22, 2024

So I started looking into this and surprisingly it already works without any changes!
As topLayoutGuide and bottomLayoutGuides are UIView subclasses. However I might make some changes to Masonry in order to support layout guide in a cleaner way.

If you look at the latest examples project it now has a example for using top and bottom layout guides

from masonry.

huyz avatar huyz commented on July 22, 2024

That topLayoutGuide.bottom should be topLayoutGuide.mas_bottom, right? The example doesn't look updated.

from masonry.

cloudkite avatar cloudkite commented on July 22, 2024

@huyz If you add #define MAS_SHORTHAND before importing Masonry.h then you can use the shorthand expressions ie view.bottom instead of view.mas_bottom

from masonry.

lluisgerard avatar lluisgerard commented on July 22, 2024

Just in case, if someone wants to do the same on Swift, just cast topLayoutGuide to AnyObject:

topView.makeConstraints({ (make: MASConstraintMaker!) -> Void in
    let topLayoutGuide : AnyObject = self.topLayoutGuide
    make.top.equalTo()(topLayoutGuide.mas_bottom)
...

from masonry.

dlahyani avatar dlahyani commented on July 22, 2024

With iOS9 they replaced the layout guides from _UILayoutGuide (internal class which is a subclass of UIView) to UILayoutGuide which is not a UIView anymore. Do you guys intend to support the new layout guides in the Masonry?

I opened an issue for that: Issue #207 .

from masonry.

hjue avatar hjue commented on July 22, 2024

The length of topLayoutGuide is difference between viewDidLoad and viewWillAppear

from masonry.

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.