Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5020
Autolayout and Autoreize Masks
posted

I'm seeing an unexpected auto layout error when a cell moves off screen.  Otherwise, the layout looks good, and the layout works 100% when the cell returns to the screen.

Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 

(

    "<NSLayoutConstraint:0x1769c940 H:|-(>=0)-[UIView:0x1769c740]   (Names: '|':UIView:0x1769c6e0 )>",

    "<NSLayoutConstraint:0x1769c9b0 H:[UIView:0x1769c740]-(>=0)-|   (Names: '|':UIView:0x1769c6e0 )>",

    "<NSLayoutConstraint:0x1769efb0 UIView:0x1769c6e0.centerX == UIView:0x1769b4b0.centerX>",

    "<NSLayoutConstraint:0x1769f240 H:|-(>=5)-[UIView:0x1769c6e0]   (Names: '|':UIView:0x1769b4b0 )>",

    "<NSLayoutConstraint:0x1769b680 H:|-(0)-[UIView:0x1769b4b0]   (Names: '|':UIView:0x17696bf0 )>",

    "<NSLayoutConstraint:0x1769b6c0 H:[UIView:0x1769b4b0]-(0)-|   (Names: '|':UIView:0x17696bf0 )>",

    "<NSLayoutConstraint:0x17696f70 H:|-(>=0)-[UIView:0x17696bf0]   (Names: '|':UIView:0x1768f710 )>",

    "<NSLayoutConstraint:0x17696fc0 H:[UIView:0x17696bf0]-(>=0)-|   (Names: '|':UIView:0x1768f710 )>",

    "<NSAutoresizingMaskLayoutConstraint:0x176a4540 h=-&- v=-&- UIView:0x1768f710.width == SemiNodeFlowLayoutViewCell:0x17690dd0.width>",

    "<NSAutoresizingMaskLayoutConstraint:0x175a0050 h=--& v=--& H:[SemiNodeFlowLayoutViewCell:0x17690dd0(0)]>"

)

Will attempt to recover by breaking constraint 

<NSLayoutConstraint:0x1769c9b0 H:[UIView:0x1769c740]-(>=0)-|   (Names: '|':UIView:0x1769c6e0 )>



(

    "<NSLayoutConstraint:0x1769efb0 UIView:0x1769c6e0.centerX == UIView:0x1769b4b0.centerX>",

    "<NSLayoutConstraint:0x1769f240 H:|-(>=5)-[UIView:0x1769c6e0]   (Names: '|':UIView:0x1769b4b0 )>",

    "<NSLayoutConstraint:0x1769b680 H:|-(0)-[UIView:0x1769b4b0]   (Names: '|':UIView:0x17696bf0 )>",

    "<NSLayoutConstraint:0x1769b6c0 H:[UIView:0x1769b4b0]-(0)-|   (Names: '|':UIView:0x17696bf0 )>",

    "<NSLayoutConstraint:0x17696f70 H:|-(>=0)-[UIView:0x17696bf0]   (Names: '|':UIView:0x1768f710 )>",

    "<NSLayoutConstraint:0x17696fc0 H:[UIView:0x17696bf0]-(>=0)-|   (Names: '|':UIView:0x1768f710 )>",

    "<NSAutoresizingMaskLayoutConstraint:0x176a4540 h=-&- v=-&- UIView:0x1768f710.width == SemiNodeFlowLayoutViewCell:0x17690dd0.width>",

    "<NSAutoresizingMaskLayoutConstraint:0x175a0050 h=--& v=--& H:[SemiNodeFlowLayoutViewCell:0x17690dd0(0)]>"

)

Will attempt to recover by breaking constraint 

<NSLayoutConstraint:0x1769efb0 UIView:0x1769c6e0.centerX == UIView:0x1769b4b0.centerX>


(

    "<NSLayoutConstraint:0x1769f240 H:|-(>=5)-[UIView:0x1769c6e0]   (Names: '|':UIView:0x1769b4b0 )>",

    "<NSLayoutConstraint:0x1769b680 H:|-(0)-[UIView:0x1769b4b0]   (Names: '|':UIView:0x17696bf0 )>",

    "<NSLayoutConstraint:0x1769b6c0 H:[UIView:0x1769b4b0]-(0)-|   (Names: '|':UIView:0x17696bf0 )>",

    "<NSLayoutConstraint:0x17696f70 H:|-(>=0)-[UIView:0x17696bf0]   (Names: '|':UIView:0x1768f710 )>",

    "<NSLayoutConstraint:0x17696fc0 H:[UIView:0x17696bf0]-(>=0)-|   (Names: '|':UIView:0x1768f710 )>",

    "<NSAutoresizingMaskLayoutConstraint:0x176a4540 h=-&- v=-&- UIView:0x1768f710.width == SemiNodeFlowLayoutViewCell:0x17690dd0.width>",

    "<NSAutoresizingMaskLayoutConstraint:0x175a0050 h=--& v=--& H:[SemiNodeFlowLayoutViewCell:0x17690dd0(0)]>",

    "<NSLayoutConstraint:0x1769f2b0 H:[UIView:0x1769c6e0]-(>=5)-|   (Names: '|':UIView:0x1769b4b0 )>"

)

Will attempt to recover by breaking constraint 

<NSLayoutConstraint:0x1769f2b0 H:[UIView:0x1769c6e0]-(>=5)-|   (Names: '|':UIView:0x1769b4b0 )>



I can prevent these from happening by changing my constraints priority from 1000 to 999, but that has other unintended consequences, too.

Thoughts?