TagFlowExample icon indicating copy to clipboard operation
TagFlowExample copied to clipboard

Unable to simultaneously satisfy constraints

Open marcasteroid opened this issue 6 years ago • 2 comments

I found this issue

`Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. 2019-06-06 22:28:25.696300+0200 Shared Shopping List[11996:175318] [LayoutConstraints] Unable to simultaneously satisfy constraints. 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) ( "<NSAutoresizingMaskLayoutConstraint:0x60000286f390 h=--& v=--& UIView:0x7fe4bee22240.height == 0 (active)>", "<NSLayoutConstraint:0x60000286f610 V:[UILabel:0x7fe4bee22420'Tech']-(8)-| (active, names: '|':UIView:0x7fe4bee22240 )>", "<NSLayoutConstraint:0x60000286f660 V:|-(8)-[UILabel:0x7fe4bee22420'Tech'] (active, names: '|':UIView:0x7fe4bee22240 )>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x60000286f610 V:[UILabel:0x7fe4bee22420'Tech']-(8)-| (active, names: '|':UIView:0x7fe4bee22240 )>`

Can't figure out what's going on here.

marcasteroid avatar Jun 06 '19 20:06 marcasteroid

The problem is here

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { self.configureCell(cell: self.sizingCell!, forIndexPath: indexPath) self.sizingCell!.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize) self.sizingCell?.sizeToFit() return (self.sizingCell?.sizeThatFits(CGSize(width: (self.sizingCell?.tagName.frame.width)!, height: 32)))! }

marcasteroid avatar Jun 07 '19 13:06 marcasteroid

The point is I am using a sizeCell to do layout calculation and return to delegate of CollectionView FlowLayout, can you check latest commit to see if update the sizingCell constraint first can help?

moonlsd avatar Jun 10 '19 04:06 moonlsd