Unable to simultaneously satisfy constraints occurs when iOS uses code adjustment constraints to animate.

Source: Internet
Author: User

When this problem occurs, you should first look at the error carefully, remove the redundant constraint of conflict,

unable to simultaneously satisfy constraints. Probably at least one of the constraintsinchThe following list isOne you don't want. Try this: (1) look at each constraint and try to figure out which you don'T expect; (2Find the code that added the unwanted constraint or constraints and fix it. (Note:if you're seeing nsautoresizingmasklayoutconstraints that's you don'T understand, refer to the documentation forThe UIView property translatesautoresizingmaskintoconstraints) (    "<nslayoutconstraint:0x170097340 v:|-(0)-[uicollectionview:0x127981200] (Names: ' | ': UIVIEW:0X1275336E0) > ",    "<nslayoutconstraint:0x170095680 v:[uicollectionview:0x127981200]-(38)-| (Names: ' | ': UIVIEW:0X1275336E0) >",    "<nslayoutconstraint:0x17009d830 v:[_uilayoutguide:0x12753f2d0]-(0)-[uiview:0x1275336e0]>",    "<nslayoutconstraint:0x1700973e0 v:[uiview:0x1275336e0]-(416)-[_uilayoutguide:0x12753f090]>",    "<_uilayoutsupportconstraint:0x1742bda60 v:[_uilayoutguide:0x12753f2d0 (0)]>",    "<_uilayoutsupportconstraint:0x1742b9560 v:|-(0)-[_uilayoutguide:0x12753f2d0] (Names: ' | ': uiview:0 x1275ce900) >",    "<_UILAYOUTSUPPORTCONSTRAINT:0X1742BDBE0 v:[_uilayoutguide:0x12753f090 (0)]>",    "<_uilayoutsupportconstraint:0x1742bd9a0 _uilayoutguide:0x12753f090.bottom = = UIView:0x1275ce900.bottom> ",    "<nslayoutconstraint:0x174284d80 ' uiview-encapsulated-layout-height ' v:[uiview:0x1275ce900 (416)]>") would attempt to recover by breaking constraint<nslayoutconstraint:0x170095680V:[uicollectionview:0x127981200]-( -)-| (Names:'|': UIView:0x1275336e0) >Make a symbolic breakpoint @ uiviewalertforunsatisfiableconstraints toCatch  This inchThe debugger. The MethodsinchThe uiconstraintbasedlayoutdebugging category on UIView listedinch<UIKit/UIView.h> may also is helpful.

If all this is done, or if it's an error, look at the order in the code to change the constraints.

-(void) updateviewconstraints {    [super updateviewconstraints];     // Hide Filter Box    _sifttopcons.constant =-screenheight+;//Top up     = screenheight-;//Bottom Up} 

For example this place, I let this view overall move up a screen height, make it hide, then should first the top of the constraint set up, and then set the bottom, similarly, when to display, the whole view to move down a screen height, you should first set the bottom of the constraint, and then set the top, All in all, don't let the size of the whole view be smaller in the process of setting it.

     
    
0 ;//Bottom out first 0 ;//top and down [UIView animatewithduration: 0.27 animations:^{ [Self.view layoutifneeded]; }];

Unable to simultaneously satisfy constraints occurs when iOS uses code adjustment constraints to animate.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.