Giter Club home page Giter Club logo

Comments (6)

jeffreycamealy avatar jeffreycamealy commented on July 22, 2024

In RootViewController if you change [_listController.view layoutIfNeeded]; to [self.view layoutIfNeeded];, the view will animate as you desire (though this is sort of a hacky workaround). Best of luck to you.

from masonry.

moughxyz avatar moughxyz commented on July 22, 2024

This doesn't address the actual issue. The recommended solution above is just a hacky workaround. What I'm really trying to figure out is how to make it work properly, and more importantly, why it's behaving like this in the first place.

from masonry.

cloudkite avatar cloudkite commented on July 22, 2024

sometimes Auto Layout does not recognise it needs updating so you can explicitly tell it.

[self.listController.view setNeedsLayout];    
[UIView animateWithDuration:0.25 animations:^{
    [self.listController.view layoutIfNeeded];
}];

from masonry.

moughxyz avatar moughxyz commented on July 22, 2024

Beast. How did you figure this out?

from masonry.

cloudkite avatar cloudkite commented on July 22, 2024

This is my Guesstimation of the situation.

Because you are creating layout constraints between self.listController.view and self.view these constraints have to be added to the closest common superview of self.listController.view and self.view which in this case is self.view (Masonry does this for you). Therefore self.listLeftConstraint only updates after self.view has finished re-laying out which would happen on the next runloop and not within your animation block as self.listController.view doesn't think it needs laying out yet. Adding [self.listController.view setNeedsLayout] forces the layout to happen within your animation block. Hope that helps and thanks for trying out Masonry.
Also for a good auto layout read checkout http://www.objc.io/issue-3/advanced-auto-layout-toolbox.html

from masonry.

cloudkite avatar cloudkite commented on July 22, 2024

adding subviews in addSampleView has the same effect as changes to the view hierarchy ie addSubview, removeFromSuperview etc will trigger setNeedsLayout

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.