坑一:
image.png
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSLayoutConstraint for <UICollectionView: 0x7fd54083f600; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7fd5458d6130>; layer = <CALayer: 0x7fd53e5684e0>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: <UICollectionViewFlowLayout: 0x7fd545815470>; dataSource: <PFLLightLessonListenbookController: 0x7fd53f01ee00>>:
A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs.'
上面说的是相对布局的属性必须成对出现,描述清楚第一个约束item和第二个约束item之间的关系,如果第二个属性是0或nil的话,无法与第一个约束item进行作用,是非法的。
经查证是子类复写父类方法,没有创建和addsubview过程。导致后面他的子类再依赖他布局的时候,secondItem为空。
A Boolean value that determines whether the view’s autoresizing mask is translated into Auto Layout constraints.
问题二:
controller.automaticallyAdjustsScrollViewInsets
网友评论