编译时候报警告:
2017-09-25 11:54:38.924350+0800 BBC_iOS[5485:113736] The behavior of the UICollectionViewFlowLayout is not defined because:
2017-09-25 11:54:38.924814+0800 BBC_iOS[5485:113736] the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values.
2017-09-25 11:54:38.925257+0800 BBC_iOS[5485:113736] Please check the values returned by the delegate.
2017-09-25 11:54:38.926719+0800 BBC_iOS[5485:113736] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7fd030c16ff0>, and it is attached to <UICollectionView: 0x7fd034861e00; frame = (55 230.5; 301 863.5); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x60c0002467b0>; layer = <CALayer: 0x60c000227a00>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}> collection view layout: <UICollectionViewFlowLayout: 0x7fd030c16ff0>.
2017-09-25 11:54:38.927103+0800 BBC_iOS[5485:113736] Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
基于项目的原因是因为,cell的宽度 和 cv 的宽度一致,宽度多减去10就好
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize.init(width: SCREEN_W - 15 - 30 - 10 - 10 - 10, height: DNCDCommentCellCell.getCellHeight(info: comment_array[indexPath.row]))
}