Showing
4 changed files
with
37 additions
and
21 deletions
No preview for this file type
... | @@ -46,7 +46,14 @@ protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject { | ... | @@ -46,7 +46,14 @@ protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject { |
46 | layout.scrollDirection = .horizontal | 46 | layout.scrollDirection = .horizontal |
47 | layout.minimumLineSpacing = 15 | 47 | layout.minimumLineSpacing = 15 |
48 | layout.minimumInteritemSpacing = 0 | 48 | layout.minimumInteritemSpacing = 0 |
49 | - layout.sectionInset = UIEdgeInsets(top: 0, left: 24, bottom: 0, right: 24) | 49 | + // layout.sectionInset = UIEdgeInsets(top: 0, left: 24, bottom: 0, right: 24) |
50 | + layout.sectionInset = UIEdgeInsets(top: 8, left: 24, bottom: 8, right: 24) | ||
51 | + | ||
52 | + // Use automatic sizing | ||
53 | +// layout.estimatedItemSize = UICollectionViewFlowLayout.automaticSize | ||
54 | + | ||
55 | + // Set estimated size with fixed height, estimated width | ||
56 | + layout.estimatedItemSize = CGSize(width: 100, height: 43) | ||
50 | } | 57 | } |
51 | 58 | ||
52 | // Enable paging for smooth banner scrolling | 59 | // Enable paging for smooth banner scrolling |
... | @@ -100,13 +107,22 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle | ... | @@ -100,13 +107,22 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle |
100 | } | 107 | } |
101 | 108 | ||
102 | // MARK: - UICollectionViewDelegateFlowLayout | 109 | // MARK: - UICollectionViewDelegateFlowLayout |
103 | -// public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { | 110 | + public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { |
104 | -// if self.data?.title == "Αγαπημένα" { | 111 | + guard let filter = self.data?[indexPath.row] else { |
105 | -// return CGSize(width: 275, height: 350) | 112 | + return CGSize(width: 80, height: 43) |
106 | -// } else { | 113 | + } |
107 | -// return CGSize(width: 257, height: 232) | 114 | + |
108 | -// } | 115 | + // Calculate width based on text content |
109 | -// } | 116 | + let text = filter.title |
117 | + let font = UIFont(name: "PingLCG-Regular", size: 16) ?? UIFont.systemFont(ofSize: 16) | ||
118 | + let textSize = text.size(withAttributes: [.font: font]) | ||
119 | + | ||
120 | + // Add padding for button design (16pt left + 16pt right = 32pt total) | ||
121 | + let width = textSize.width + 32 | ||
122 | + | ||
123 | + // Fixed height of 43pt, dynamic width | ||
124 | + return CGSize(width: max(width, 60), height: 43) // Minimum width of 60pt | ||
125 | + } | ||
110 | 126 | ||
111 | // Distance Between Item Cells | 127 | // Distance Between Item Cells |
112 | public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { | 128 | public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { | ... | ... |
... | @@ -12,21 +12,21 @@ | ... | @@ -12,21 +12,21 @@ |
12 | <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ProfileCouponFiltersTableViewCell" rowHeight="161" id="KGk-i7-Jjw" customClass="ProfileCouponFiltersTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target"> | 12 | <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ProfileCouponFiltersTableViewCell" rowHeight="161" id="KGk-i7-Jjw" customClass="ProfileCouponFiltersTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target"> |
13 | <rect key="frame" x="0.0" y="0.0" width="320" height="161"/> | 13 | <rect key="frame" x="0.0" y="0.0" width="320" height="161"/> |
14 | <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | 14 | <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> |
15 | - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> | 15 | + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> |
16 | <rect key="frame" x="0.0" y="0.0" width="320" height="161"/> | 16 | <rect key="frame" x="0.0" y="0.0" width="320" height="161"/> |
17 | <autoresizingMask key="autoresizingMask"/> | 17 | <autoresizingMask key="autoresizingMask"/> |
18 | <subviews> | 18 | <subviews> |
19 | - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1kR-zd-duR" userLabel="ParentView"> | 19 | + <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1kR-zd-duR" userLabel="ParentView"> |
20 | <rect key="frame" x="0.0" y="0.0" width="320" height="161"/> | 20 | <rect key="frame" x="0.0" y="0.0" width="320" height="161"/> |
21 | <subviews> | 21 | <subviews> |
22 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mga-ND-qoh"> | 22 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mga-ND-qoh"> |
23 | - <rect key="frame" x="24" y="26" width="272" height="14"/> | 23 | + <rect key="frame" x="24" y="26" width="272" height="20.333333333333329"/> |
24 | <fontDescription key="fontDescription" type="system" pointSize="17"/> | 24 | <fontDescription key="fontDescription" type="system" pointSize="17"/> |
25 | <nil key="textColor"/> | 25 | <nil key="textColor"/> |
26 | <nil key="highlightedColor"/> | 26 | <nil key="highlightedColor"/> |
27 | </label> | 27 | </label> |
28 | <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Ddn-dN-xH1"> | 28 | <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Ddn-dN-xH1"> |
29 | - <rect key="frame" x="0.0" y="83" width="320" height="48"/> | 29 | + <rect key="frame" x="0.0" y="105.33333333333331" width="320" height="48"/> |
30 | <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | 30 | <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
31 | <constraints> | 31 | <constraints> |
32 | <constraint firstAttribute="height" constant="48" id="5nG-1p-kic"/> | 32 | <constraint firstAttribute="height" constant="48" id="5nG-1p-kic"/> |
... | @@ -46,7 +46,7 @@ | ... | @@ -46,7 +46,7 @@ |
46 | </subviews> | 46 | </subviews> |
47 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | 47 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
48 | <constraints> | 48 | <constraints> |
49 | - <constraint firstItem="Ddn-dN-xH1" firstAttribute="top" secondItem="mga-ND-qoh" secondAttribute="bottom" constant="43" id="1gh-45-u6h"/> | 49 | + <constraint firstItem="Ddn-dN-xH1" firstAttribute="top" secondItem="mga-ND-qoh" secondAttribute="bottom" constant="59" id="1gh-45-u6h"/> |
50 | <constraint firstItem="Ddn-dN-xH1" firstAttribute="leading" secondItem="1kR-zd-duR" secondAttribute="leading" id="3IU-v8-7cI"/> | 50 | <constraint firstItem="Ddn-dN-xH1" firstAttribute="leading" secondItem="1kR-zd-duR" secondAttribute="leading" id="3IU-v8-7cI"/> |
51 | <constraint firstItem="mga-ND-qoh" firstAttribute="top" secondItem="1kR-zd-duR" secondAttribute="top" constant="26" id="J0I-v0-uwq"/> | 51 | <constraint firstItem="mga-ND-qoh" firstAttribute="top" secondItem="1kR-zd-duR" secondAttribute="top" constant="26" id="J0I-v0-uwq"/> |
52 | <constraint firstAttribute="trailing" secondItem="mga-ND-qoh" secondAttribute="trailing" constant="24" id="Ss1-zq-znd"/> | 52 | <constraint firstAttribute="trailing" secondItem="mga-ND-qoh" secondAttribute="trailing" constant="24" id="Ss1-zq-znd"/> | ... | ... |
... | @@ -11,17 +11,17 @@ | ... | @@ -11,17 +11,17 @@ |
11 | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> | 11 | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> |
12 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | 12 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
13 | <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ProfileFilterCollectionViewCell" id="gTV-IL-0wX" customClass="ProfileFilterCollectionViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target"> | 13 | <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ProfileFilterCollectionViewCell" id="gTV-IL-0wX" customClass="ProfileFilterCollectionViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target"> |
14 | - <rect key="frame" x="0.0" y="0.0" width="145" height="66"/> | 14 | + <rect key="frame" x="0.0" y="0.0" width="145" height="43"/> |
15 | <autoresizingMask key="autoresizingMask"/> | 15 | <autoresizingMask key="autoresizingMask"/> |
16 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> | 16 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> |
17 | - <rect key="frame" x="0.0" y="0.0" width="145" height="66"/> | 17 | + <rect key="frame" x="0.0" y="0.0" width="145" height="43"/> |
18 | <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | 18 | <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> |
19 | <subviews> | 19 | <subviews> |
20 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NgU-Qp-M8l" userLabel="ParentView"> | 20 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NgU-Qp-M8l" userLabel="ParentView"> |
21 | - <rect key="frame" x="0.0" y="0.0" width="145" height="66"/> | 21 | + <rect key="frame" x="0.0" y="0.0" width="145" height="43"/> |
22 | <subviews> | 22 | <subviews> |
23 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xq0-AN-QT6"> | 23 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xq0-AN-QT6"> |
24 | - <rect key="frame" x="17" y="12" width="111" height="42"/> | 24 | + <rect key="frame" x="17" y="11.333333333333334" width="111" height="20.333333333333329"/> |
25 | <fontDescription key="fontDescription" type="system" pointSize="17"/> | 25 | <fontDescription key="fontDescription" type="system" pointSize="17"/> |
26 | <nil key="textColor"/> | 26 | <nil key="textColor"/> |
27 | <nil key="highlightedColor"/> | 27 | <nil key="highlightedColor"/> |
... | @@ -29,10 +29,10 @@ | ... | @@ -29,10 +29,10 @@ |
29 | </subviews> | 29 | </subviews> |
30 | <color key="backgroundColor" systemColor="systemBackgroundColor"/> | 30 | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
31 | <constraints> | 31 | <constraints> |
32 | - <constraint firstItem="Xq0-AN-QT6" firstAttribute="top" secondItem="NgU-Qp-M8l" secondAttribute="top" constant="12" id="Nro-8v-U0C"/> | 32 | + <constraint firstAttribute="height" constant="43" id="KOh-gz-4af"/> |
33 | + <constraint firstItem="Xq0-AN-QT6" firstAttribute="centerY" secondItem="NgU-Qp-M8l" secondAttribute="centerY" id="aI4-7F-CI7"/> | ||
33 | <constraint firstAttribute="trailing" secondItem="Xq0-AN-QT6" secondAttribute="trailing" constant="17" id="hKh-jv-VQR"/> | 34 | <constraint firstAttribute="trailing" secondItem="Xq0-AN-QT6" secondAttribute="trailing" constant="17" id="hKh-jv-VQR"/> |
34 | <constraint firstItem="Xq0-AN-QT6" firstAttribute="leading" secondItem="NgU-Qp-M8l" secondAttribute="leading" constant="17" id="na6-tV-KQZ"/> | 35 | <constraint firstItem="Xq0-AN-QT6" firstAttribute="leading" secondItem="NgU-Qp-M8l" secondAttribute="leading" constant="17" id="na6-tV-KQZ"/> |
35 | - <constraint firstAttribute="bottom" secondItem="Xq0-AN-QT6" secondAttribute="bottom" constant="12" id="pJO-74-XZO"/> | ||
36 | </constraints> | 36 | </constraints> |
37 | </view> | 37 | </view> |
38 | </subviews> | 38 | </subviews> |
... | @@ -45,12 +45,12 @@ | ... | @@ -45,12 +45,12 @@ |
45 | <constraint firstItem="NgU-Qp-M8l" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="l7p-or-kC2"/> | 45 | <constraint firstItem="NgU-Qp-M8l" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="l7p-or-kC2"/> |
46 | <constraint firstAttribute="bottom" secondItem="NgU-Qp-M8l" secondAttribute="bottom" id="te6-Qr-T6c"/> | 46 | <constraint firstAttribute="bottom" secondItem="NgU-Qp-M8l" secondAttribute="bottom" id="te6-Qr-T6c"/> |
47 | </constraints> | 47 | </constraints> |
48 | - <size key="customSize" width="145" height="66"/> | 48 | + <size key="customSize" width="145" height="43"/> |
49 | <connections> | 49 | <connections> |
50 | <outlet property="parentView" destination="NgU-Qp-M8l" id="qhP-z2-cWY"/> | 50 | <outlet property="parentView" destination="NgU-Qp-M8l" id="qhP-z2-cWY"/> |
51 | <outlet property="titleLabel" destination="Xq0-AN-QT6" id="Hft-IP-ITh"/> | 51 | <outlet property="titleLabel" destination="Xq0-AN-QT6" id="Hft-IP-ITh"/> |
52 | </connections> | 52 | </connections> |
53 | - <point key="canvasLocation" x="109.16030534351144" y="-5.6338028169014089"/> | 53 | + <point key="canvasLocation" x="109.16030534351144" y="-13.732394366197184"/> |
54 | </collectionViewCell> | 54 | </collectionViewCell> |
55 | </objects> | 55 | </objects> |
56 | <resources> | 56 | <resources> | ... | ... |
-
Please register or login to post a comment