集合视图单元格的动态大小

时间:2015-03-12 14:28:59

标签: ios cell collectionview

我正在尝试动态设置集合视图单元格的大小:

self.itemSize = CGSizeMake(((self.collectionView.bounds.size.width / self.numberOfColumns) - self.itemInsets.left -
                            self.itemInsets.right), ((self.collectionView.bounds.size.width / self.numberOfRows) - self.itemInsets.top - self.itemInsets.bottom));

我在日志中遇到以下错误:

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:0x14dcf530 UIImageView:0x14dcf290.leading == UIView:0x14dcf1f0.leadingMargin>",
    "<NSLayoutConstraint:0x14dcf590 UIView:0x14dcf1f0.trailingMargin == UIImageView:0x14dcf290.trailing>",
    "<NSAutoresizingMaskLayoutConstraint:0x14eb4c40 h=--& v=--& H:[UIView:0x14dcf1f0(4)]>"
)

我该如何解决?

0 个答案:

没有答案