From e7dcf75eeac08593c9f996bac5dacb6473a96ec8 Mon Sep 17 00:00:00 2001 From: Pei Date: Mon, 25 Mar 2019 12:04:38 +0800 Subject: [PATCH] - fix an issue of calculating cell width not properly --- PARTagPicker/Classes/PARTagPickerViewController.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PARTagPicker/Classes/PARTagPickerViewController.m b/PARTagPicker/Classes/PARTagPickerViewController.m index cc4ecfe..be4b773 100644 --- a/PARTagPicker/Classes/PARTagPickerViewController.m +++ b/PARTagPicker/Classes/PARTagPickerViewController.m @@ -331,6 +331,9 @@ - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollection } sizingCell.tagLabel.text = tag; sizingCell.tagLabel.font = self.font; + [sizingCell setNeedsLayout]; + [sizingCell layoutIfNeeded]; + CGSize size = [sizingCell systemLayoutSizeFittingSize:CGSizeMake(collectionView.contentSize.width, TAGCOLLECTION_CELL_HEIGHT) withHorizontalFittingPriority:UILayoutPriorityDefaultLow verticalFittingPriority:UILayoutPriorityDefaultHigh]; return size; }