我有一个autolayout的问题,控制台报告问题,我有一个单元格中的图像视图:
RefreshCatalogue[31754:16177989] 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) ( "<NSLayoutConstraint:0x7fa98103b740 V:[UIImageView:0x7fa9810375d0]-(0)-| (Names: '|':UIView:0x7fa9810371d0 )>","<NSLayoutConstraint:0x7fa98103b7e0 V:|-(0)-[UIImageView:0x7fa9810375d0] (Names: '|':UIView:0x7fa9810371d0 )>","<NSLayoutConstraint:0x7fa98103b8d0 UIImageView:0x7fa9810375d0.centerY == UIImageView:0x7fa981037490.centerY>","<NSLayoutConstraint:0x7fa98103ba60 UIImageView:0x7fa981037490.top == UIView:0x7fa9810371d0.topMargin + 71>","<NSAutoresizingMaskLayoutConstraint:0x7fa980d44a10 h=--& v=--& V:[UIView:0x7fa9810371d0(50)]>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x7fa98103b8d0 UIImageView:0x7fa9810375d0.centerY == UIImageView:0x7fa981037490.centerY> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
问题是如果我这样做:
[self.collectionView reloadItemsAtIndexPaths:@[indexPath]];
没有什么显示甚至图像视图似乎有正确的框架,图像属性设置.
如果我重新加载整个集合视图:
[self.collectionView reloadData];
错误仍然存在,但图像显示.代码在这里开放,任何人都有兴趣看看:
https://github.com/Ridiculous-Innovations/RefreshCatalogue
此外,故事板中的所有限制似乎都是蓝色的.任何想法可能导致这个问题?
编辑:不用说,所有的元素,包括图像视图在正确的地方(我做了调试框架和设置随机颜色),但图像没有显示,直到刷新…有时,单元格根本不显示