Giter Club home page Giter Club logo

Comments (7)

Pratik-Sodha avatar Pratik-Sodha commented on July 22, 2024 1

topLayoutGuide deprecated in iOS 11, Use view.safeAreaLayoutGuide.topAnchor instead of topLayoutGuide.bottomAnchor_

        txtLink.snp.makeConstraints { (make) in
            make.top.equalTo(self.view.safeAreaLayoutGuide).inset(20)
        }

from masonry.

akashivskyy avatar akashivskyy commented on July 22, 2024

I managed to do what I want using [viewController setEdgesForExtendedLayout:UIRectEdgeNone], but I'll leave this issue open as a feature request or at least to get an answer.

from masonry.

cloudkite avatar cloudkite commented on July 22, 2024

At the moment topLayoutGuide and bottomLayoutGuide are not supported directly. However you could try using the length property of topLayoutGuide:

[self.emailTextField mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.view.mas_top).with.offset(self.topLayoutGuide.length + 20);
}];

if self.view is self.emailTextField's superview, then you could also write this as

[self.emailTextField mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(@(self.topLayoutGuide.length + 20));
}];

Let me know if that works for you

from masonry.

akashivskyy avatar akashivskyy commented on July 22, 2024

Yes, that kinda works, but I ended up by implementing my own version of those layout guides (for the sake of iOS 6 compatibility).

The problem with topLayoutGuide is that it is only correct when using only in several methods, but both examples that you provided work well.

from masonry.

juri avatar juri commented on July 22, 2024

The problem with the .length workaround is that you often want a dynamic constraint. For example, if you have a view controller loaded from a XIB but want to add controls to the view, topLayoutGuide.length is 0 in -viewDidLoad and -viewWillAppear: but will go to 64 before viewDidAppear: if you are using a navigation bar. I usually want to add my subviews and their constraints before the view is on screen. Having direct support would be helpful.

from masonry.

cloudkite avatar cloudkite commented on July 22, 2024

@juri a dynamic solution was found in this issue #27 thanks

from masonry.

juri avatar juri commented on July 22, 2024

Oh excellent, thanks and sorry for the noise!

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.