Manos Chorianopoulos

ProfileCouponFiltersTableViewCell fixes

......@@ -46,7 +46,14 @@ protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject {
layout.scrollDirection = .horizontal
layout.minimumLineSpacing = 15
layout.minimumInteritemSpacing = 0
layout.sectionInset = UIEdgeInsets(top: 0, left: 24, bottom: 0, right: 24)
// layout.sectionInset = UIEdgeInsets(top: 0, left: 24, bottom: 0, right: 24)
layout.sectionInset = UIEdgeInsets(top: 8, left: 24, bottom: 8, right: 24)
// Use automatic sizing
// layout.estimatedItemSize = UICollectionViewFlowLayout.automaticSize
// Set estimated size with fixed height, estimated width
layout.estimatedItemSize = CGSize(width: 100, height: 43)
}
// Enable paging for smooth banner scrolling
......@@ -100,13 +107,22 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle
}
// MARK: - UICollectionViewDelegateFlowLayout
// public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
// if self.data?.title == "Αγαπημένα" {
// return CGSize(width: 275, height: 350)
// } else {
// return CGSize(width: 257, height: 232)
// }
// }
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
guard let filter = self.data?[indexPath.row] else {
return CGSize(width: 80, height: 43)
}
// Calculate width based on text content
let text = filter.title
let font = UIFont(name: "PingLCG-Regular", size: 16) ?? UIFont.systemFont(ofSize: 16)
let textSize = text.size(withAttributes: [.font: font])
// Add padding for button design (16pt left + 16pt right = 32pt total)
let width = textSize.width + 32
// Fixed height of 43pt, dynamic width
return CGSize(width: max(width, 60), height: 43) // Minimum width of 60pt
}
// Distance Between Item Cells
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
......
......@@ -12,21 +12,21 @@
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ProfileCouponFiltersTableViewCell" rowHeight="161" id="KGk-i7-Jjw" customClass="ProfileCouponFiltersTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="161"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="161"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1kR-zd-duR" userLabel="ParentView">
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1kR-zd-duR" userLabel="ParentView">
<rect key="frame" x="0.0" y="0.0" width="320" height="161"/>
<subviews>
<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">
<rect key="frame" x="24" y="26" width="272" height="14"/>
<rect key="frame" x="24" y="26" width="272" height="20.333333333333329"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Ddn-dN-xH1">
<rect key="frame" x="0.0" y="83" width="320" height="48"/>
<rect key="frame" x="0.0" y="105.33333333333331" width="320" height="48"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="48" id="5nG-1p-kic"/>
......@@ -46,7 +46,7 @@
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Ddn-dN-xH1" firstAttribute="top" secondItem="mga-ND-qoh" secondAttribute="bottom" constant="43" id="1gh-45-u6h"/>
<constraint firstItem="Ddn-dN-xH1" firstAttribute="top" secondItem="mga-ND-qoh" secondAttribute="bottom" constant="59" id="1gh-45-u6h"/>
<constraint firstItem="Ddn-dN-xH1" firstAttribute="leading" secondItem="1kR-zd-duR" secondAttribute="leading" id="3IU-v8-7cI"/>
<constraint firstItem="mga-ND-qoh" firstAttribute="top" secondItem="1kR-zd-duR" secondAttribute="top" constant="26" id="J0I-v0-uwq"/>
<constraint firstAttribute="trailing" secondItem="mga-ND-qoh" secondAttribute="trailing" constant="24" id="Ss1-zq-znd"/>
......
......@@ -11,17 +11,17 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ProfileFilterCollectionViewCell" id="gTV-IL-0wX" customClass="ProfileFilterCollectionViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="145" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="145" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="145" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="145" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NgU-Qp-M8l" userLabel="ParentView">
<rect key="frame" x="0.0" y="0.0" width="145" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="145" height="43"/>
<subviews>
<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">
<rect key="frame" x="17" y="12" width="111" height="42"/>
<rect key="frame" x="17" y="11.333333333333334" width="111" height="20.333333333333329"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
......@@ -29,10 +29,10 @@
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="Xq0-AN-QT6" firstAttribute="top" secondItem="NgU-Qp-M8l" secondAttribute="top" constant="12" id="Nro-8v-U0C"/>
<constraint firstAttribute="height" constant="43" id="KOh-gz-4af"/>
<constraint firstItem="Xq0-AN-QT6" firstAttribute="centerY" secondItem="NgU-Qp-M8l" secondAttribute="centerY" id="aI4-7F-CI7"/>
<constraint firstAttribute="trailing" secondItem="Xq0-AN-QT6" secondAttribute="trailing" constant="17" id="hKh-jv-VQR"/>
<constraint firstItem="Xq0-AN-QT6" firstAttribute="leading" secondItem="NgU-Qp-M8l" secondAttribute="leading" constant="17" id="na6-tV-KQZ"/>
<constraint firstAttribute="bottom" secondItem="Xq0-AN-QT6" secondAttribute="bottom" constant="12" id="pJO-74-XZO"/>
</constraints>
</view>
</subviews>
......@@ -45,12 +45,12 @@
<constraint firstItem="NgU-Qp-M8l" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="l7p-or-kC2"/>
<constraint firstAttribute="bottom" secondItem="NgU-Qp-M8l" secondAttribute="bottom" id="te6-Qr-T6c"/>
</constraints>
<size key="customSize" width="145" height="66"/>
<size key="customSize" width="145" height="43"/>
<connections>
<outlet property="parentView" destination="NgU-Qp-M8l" id="qhP-z2-cWY"/>
<outlet property="titleLabel" destination="Xq0-AN-QT6" id="Hft-IP-ITh"/>
</connections>
<point key="canvasLocation" x="109.16030534351144" y="-5.6338028169014089"/>
<point key="canvasLocation" x="109.16030534351144" y="-13.732394366197184"/>
</collectionViewCell>
</objects>
<resources>
......