@@ -45,21 +45,21 @@ - (void)viewDidLayoutSubviews {
4545
4646 if (CGRectGetWidth (self.view .bounds ) <= [QMUIHelper screenSizeFor55Inch ].width ) {
4747 self.gridView .columnCount = 3 ;
48- CGFloat itemWidth = flatf (CGRectGetWidth (self.scrollView .bounds ) / self.gridView .columnCount );
48+ CGFloat itemWidth = flat (CGRectGetWidth (self.scrollView .bounds ) / self.gridView .columnCount );
4949 self.gridView .rowHeight = itemWidth;
5050 } else {
51- CGFloat minimumItemWidth = flatf ([QMUIHelper screenSizeFor55Inch ].width / 3.0 );
52- CGFloat maximumItemWidth = flatf (CGRectGetWidth (self.view .bounds ) / 5.0 );
53- CGFloat freeSpacingWhenDisplayingMinimumCount = CGRectGetWidth (self.scrollView .bounds ) / maximumItemWidth - floorf (CGRectGetWidth (self.scrollView .bounds ) / maximumItemWidth);
54- CGFloat freeSpacingWhenDisplayingMaximumCount = CGRectGetWidth (self.scrollView .bounds ) / minimumItemWidth - floorf (CGRectGetWidth (self.scrollView .bounds ) / minimumItemWidth);
51+ CGFloat minimumItemWidth = flat ([QMUIHelper screenSizeFor55Inch ].width / 3.0 );
52+ CGFloat maximumItemWidth = flat (CGRectGetWidth (self.view .bounds ) / 5.0 );
53+ CGFloat freeSpacingWhenDisplayingMinimumCount = CGRectGetWidth (self.scrollView .bounds ) / maximumItemWidth - floor (CGRectGetWidth (self.scrollView .bounds ) / maximumItemWidth);
54+ CGFloat freeSpacingWhenDisplayingMaximumCount = CGRectGetWidth (self.scrollView .bounds ) / minimumItemWidth - floor (CGRectGetWidth (self.scrollView .bounds ) / minimumItemWidth);
5555 if (freeSpacingWhenDisplayingMinimumCount < freeSpacingWhenDisplayingMaximumCount) {
5656 // 按每行最少item的情况来布局的话,空间利用率会更高,所以按最少item来
57- self.gridView .columnCount = floorf (CGRectGetWidth (self.scrollView .bounds ) / maximumItemWidth);
58- CGFloat itemWidth = floorf (CGRectGetWidth (self.scrollView .bounds ) / self.gridView .columnCount );
57+ self.gridView .columnCount = floor (CGRectGetWidth (self.scrollView .bounds ) / maximumItemWidth);
58+ CGFloat itemWidth = floor (CGRectGetWidth (self.scrollView .bounds ) / self.gridView .columnCount );
5959 self.gridView .rowHeight = itemWidth;
6060 } else {
61- self.gridView .columnCount = floorf (CGRectGetWidth (self.scrollView .bounds ) / minimumItemWidth);
62- CGFloat itemWidth = floorf (CGRectGetWidth (self.scrollView .bounds ) / self.gridView .columnCount );
61+ self.gridView .columnCount = floor (CGRectGetWidth (self.scrollView .bounds ) / minimumItemWidth);
62+ CGFloat itemWidth = floor (CGRectGetWidth (self.scrollView .bounds ) / self.gridView .columnCount );
6363 self.gridView .rowHeight = itemWidth;
6464 }
6565 }
@@ -125,7 +125,7 @@ - (void)layoutSubviews {
125125 }
126126
127127 CGSize contentSize = CGSizeMake (CGRectGetWidth (self.bounds ) - UIEdgeInsetsGetHorizontalValue (self.contentEdgeInsets ), CGRectGetHeight (self.bounds ) - UIEdgeInsetsGetVerticalValue (self.contentEdgeInsets ));
128- CGPoint center = CGPointMake (flatf (self.contentEdgeInsets .left + contentSize.width / 2 ), flatf (self.contentEdgeInsets .top + contentSize.height / 2 ));
128+ CGPoint center = CGPointMake (flat (self.contentEdgeInsets .left + contentSize.width / 2 ), flat (self.contentEdgeInsets .top + contentSize.height / 2 ));
129129
130130 self.imageView .center = CGPointMake (center.x , center.y - 12 );
131131
0 commit comments