Manos Chorianopoulos

fix PopupMerchantsViewController dynamic height

...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>0</integer> 10 + <integer>1</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>1</integer> 10 + <integer>0</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -6398,7 +6398,7 @@ ...@@ -6398,7 +6398,7 @@
6398 <constraint firstAttribute="bottom" secondItem="kH9-FC-wgF" secondAttribute="bottom" id="cNA-DV-1fn"/> 6398 <constraint firstAttribute="bottom" secondItem="kH9-FC-wgF" secondAttribute="bottom" id="cNA-DV-1fn"/>
6399 </constraints> 6399 </constraints>
6400 </view> 6400 </view>
6401 - <tableView clipsSubviews="YES" contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="vet-Po-Bmf" customClass="DynamicSizeTableView" customModule="SwiftWarplyFramework" customModuleProvider="target"> 6401 + <tableView clipsSubviews="YES" contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="vet-Po-Bmf" customClass="DynamicSizeMerchantsTableView" customModule="SwiftWarplyFramework" customModuleProvider="target">
6402 <rect key="frame" x="0.0" y="50" width="414" height="250"/> 6402 <rect key="frame" x="0.0" y="50" width="414" height="250"/>
6403 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 6403 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
6404 <color key="separatorColor" red="0.68235294120000001" green="0.68235294120000001" blue="0.68235294120000001" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/> 6404 <color key="separatorColor" red="0.68235294120000001" green="0.68235294120000001" blue="0.68235294120000001" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
...@@ -6406,10 +6406,10 @@ ...@@ -6406,10 +6406,10 @@
6406 <color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 6406 <color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
6407 <prototypes> 6407 <prototypes>
6408 <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="MerchantTableViewCellId" id="fym-iB-q6x" customClass="MerchantTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target"> 6408 <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="MerchantTableViewCellId" id="fym-iB-q6x" customClass="MerchantTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
6409 - <rect key="frame" x="0.0" y="50" width="414" height="56"/> 6409 + <rect key="frame" x="0.0" y="50" width="414" height="88"/>
6410 <autoresizingMask key="autoresizingMask"/> 6410 <autoresizingMask key="autoresizingMask"/>
6411 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="fym-iB-q6x" id="jOZ-KL-eu1"> 6411 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="fym-iB-q6x" id="jOZ-KL-eu1">
6412 - <rect key="frame" x="0.0" y="0.0" width="414" height="56"/> 6412 + <rect key="frame" x="0.0" y="0.0" width="414" height="88"/>
6413 <autoresizingMask key="autoresizingMask"/> 6413 <autoresizingMask key="autoresizingMask"/>
6414 <subviews> 6414 <subviews>
6415 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TQn-b5-U6q"> 6415 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TQn-b5-U6q">
...@@ -6479,7 +6479,7 @@ ...@@ -6479,7 +6479,7 @@
6479 </subviews> 6479 </subviews>
6480 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 6480 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
6481 <constraints> 6481 <constraints>
6482 - <constraint firstAttribute="bottom" secondItem="TQn-b5-U6q" secondAttribute="bottom" id="DlG-eC-Miw"/> 6482 + <constraint firstAttribute="bottom" secondItem="TQn-b5-U6q" secondAttribute="bottom" constant="32" id="DlG-eC-Miw"/>
6483 <constraint firstItem="TQn-b5-U6q" firstAttribute="top" secondItem="jOZ-KL-eu1" secondAttribute="top" id="Znl-Kn-l4H"/> 6483 <constraint firstItem="TQn-b5-U6q" firstAttribute="top" secondItem="jOZ-KL-eu1" secondAttribute="top" id="Znl-Kn-l4H"/>
6484 <constraint firstItem="TQn-b5-U6q" firstAttribute="leading" secondItem="jOZ-KL-eu1" secondAttribute="leading" constant="18" id="dsI-sU-JVJ"/> 6484 <constraint firstItem="TQn-b5-U6q" firstAttribute="leading" secondItem="jOZ-KL-eu1" secondAttribute="leading" constant="18" id="dsI-sU-JVJ"/>
6485 <constraint firstAttribute="trailing" secondItem="TQn-b5-U6q" secondAttribute="trailing" constant="18" id="prx-5Z-TVo"/> 6485 <constraint firstAttribute="trailing" secondItem="TQn-b5-U6q" secondAttribute="trailing" constant="18" id="prx-5Z-TVo"/>
...@@ -6496,7 +6496,7 @@ ...@@ -6496,7 +6496,7 @@
6496 </connections> 6496 </connections>
6497 </tableViewCell> 6497 </tableViewCell>
6498 <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="PopupMerchantsFooterTableViewCellId" id="f5f-VE-AbI" customClass="PopupMerchantsFooterTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target"> 6498 <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="PopupMerchantsFooterTableViewCellId" id="f5f-VE-AbI" customClass="PopupMerchantsFooterTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
6499 - <rect key="frame" x="0.0" y="106" width="414" height="50"/> 6499 + <rect key="frame" x="0.0" y="138" width="414" height="50"/>
6500 <autoresizingMask key="autoresizingMask"/> 6500 <autoresizingMask key="autoresizingMask"/>
6501 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="f5f-VE-AbI" id="YhO-v9-8eO"> 6501 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="f5f-VE-AbI" id="YhO-v9-8eO">
6502 <rect key="frame" x="0.0" y="0.0" width="414" height="50"/> 6502 <rect key="frame" x="0.0" y="0.0" width="414" height="50"/>
...@@ -6549,7 +6549,6 @@ ...@@ -6549,7 +6549,6 @@
6549 <constraint firstAttribute="bottom" secondItem="vet-Po-Bmf" secondAttribute="bottom" id="B03-fG-aC2"/> 6549 <constraint firstAttribute="bottom" secondItem="vet-Po-Bmf" secondAttribute="bottom" id="B03-fG-aC2"/>
6550 <constraint firstItem="vet-Po-Bmf" firstAttribute="leading" secondItem="cSR-WK-qb0" secondAttribute="leading" id="F8e-cg-wdq"/> 6550 <constraint firstItem="vet-Po-Bmf" firstAttribute="leading" secondItem="cSR-WK-qb0" secondAttribute="leading" id="F8e-cg-wdq"/>
6551 <constraint firstItem="MNf-7L-OWL" firstAttribute="top" secondItem="cSR-WK-qb0" secondAttribute="top" constant="15" id="N8O-in-CB3"/> 6551 <constraint firstItem="MNf-7L-OWL" firstAttribute="top" secondItem="cSR-WK-qb0" secondAttribute="top" constant="15" id="N8O-in-CB3"/>
6552 - <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="320" id="c1w-Ub-vF7"/>
6553 <constraint firstItem="vet-Po-Bmf" firstAttribute="top" secondItem="MNf-7L-OWL" secondAttribute="bottom" constant="15" id="hl9-87-bJ7"/> 6552 <constraint firstItem="vet-Po-Bmf" firstAttribute="top" secondItem="MNf-7L-OWL" secondAttribute="bottom" constant="15" id="hl9-87-bJ7"/>
6554 <constraint firstAttribute="trailing" secondItem="vet-Po-Bmf" secondAttribute="trailing" id="lgN-8i-jJk"/> 6553 <constraint firstAttribute="trailing" secondItem="vet-Po-Bmf" secondAttribute="trailing" id="lgN-8i-jJk"/>
6555 </constraints> 6554 </constraints>
......
...@@ -66,12 +66,12 @@ class MerchantTableViewCell: UITableViewCell { ...@@ -66,12 +66,12 @@ class MerchantTableViewCell: UITableViewCell {
66 // Configure the view for the selected state 66 // Configure the view for the selected state
67 } 67 }
68 68
69 - public override func layoutSubviews() { 69 +// public override func layoutSubviews() {
70 - super.layoutSubviews() 70 +// super.layoutSubviews()
71 - //set the values for top,left,bottom,right margins 71 +// //set the values for top,left,bottom,right margins
72 - let margins = UIEdgeInsets(top: 0, left: 0, bottom: 32, right: 0) 72 +// let margins = UIEdgeInsets(top: 0, left: 0, bottom: 32, right: 0)
73 - contentView.frame = contentView.frame.inset(by: margins) 73 +// contentView.frame = contentView.frame.inset(by: margins)
74 - } 74 +// }
75 75
76 func configureCell(shop: swiftApi.ShopAvailabilityItemModel, buttonTitle: String, iconImage: String?, showEshops: Bool?) { 76 func configureCell(shop: swiftApi.ShopAvailabilityItemModel, buttonTitle: String, iconImage: String?, showEshops: Bool?) {
77 77
......
...@@ -188,8 +188,12 @@ extension NumberPopupViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -188,8 +188,12 @@ extension NumberPopupViewController: UITableViewDelegate, UITableViewDataSource{
188 } 188 }
189 } 189 }
190 190
191 + // override public var intrinsicContentSize: CGSize {
192 + // return contentSize
193 + // }
194 +
191 override public var intrinsicContentSize: CGSize { 195 override public var intrinsicContentSize: CGSize {
192 - return contentSize 196 + return CGSize(width: UIView.noIntrinsicMetric, height: contentSize.height + contentInset.top + contentInset.bottom)
193 } 197 }
194 } 198 }
195 199
......
...@@ -11,7 +11,7 @@ class PopupMerchantsViewController: UIViewController { ...@@ -11,7 +11,7 @@ class PopupMerchantsViewController: UIViewController {
11 @IBOutlet weak var popupView: UIView! 11 @IBOutlet weak var popupView: UIView!
12 @IBOutlet weak var headerLabel: UILabel! 12 @IBOutlet weak var headerLabel: UILabel!
13 @IBOutlet weak var closeButton: UIButton! 13 @IBOutlet weak var closeButton: UIButton!
14 - @IBOutlet weak var tableView: DynamicSizeTableView! 14 + @IBOutlet weak var tableView: DynamicSizeMerchantsTableView!
15 15
16 public var availableShopsList:Array<swiftApi.ShopAvailabilityItemModel> = [] 16 public var availableShopsList:Array<swiftApi.ShopAvailabilityItemModel> = []
17 // public var coupon: swiftApi.CouponItemModel? 17 // public var coupon: swiftApi.CouponItemModel?
...@@ -45,6 +45,8 @@ class PopupMerchantsViewController: UIViewController { ...@@ -45,6 +45,8 @@ class PopupMerchantsViewController: UIViewController {
45 self.headerLabel.text = self.headerText 45 self.headerLabel.text = self.headerText
46 headerLabel.font = UIFont(name: "BTCosmo-Bold", size: 18) 46 headerLabel.font = UIFont(name: "BTCosmo-Bold", size: 18)
47 headerLabel.textColor = UIColor(rgb: 0x000000) 47 headerLabel.textColor = UIColor(rgb: 0x000000)
48 +
49 +// setupFooterView()
48 } 50 }
49 51
50 // MARK: - Functions 52 // MARK: - Functions
...@@ -60,6 +62,38 @@ class PopupMerchantsViewController: UIViewController { ...@@ -60,6 +62,38 @@ class PopupMerchantsViewController: UIViewController {
60 availableShopsList.append(tempShop2) 62 availableShopsList.append(tempShop2)
61 } 63 }
62 64
65 +// private func setupFooterView() {
66 +// // Create a footer view container
67 +// let footerView = UIView()
68 +// footerView.backgroundColor = .clear
69 +//
70 +// // Create a label for the footer
71 +// let footerLabel = UILabel()
72 +// footerLabel.text = "Η διαθεσιμότητα ενδέχεται να διαφέρει ανάλογα με την τοποθεσία."
73 +// footerLabel.textAlignment = .center
74 +// footerLabel.font = UIFont(name: "PeridotPE-Regular", size: 13)
75 +// footerLabel.textColor = UIColor(rgb: 0x000000)
76 +// footerLabel.numberOfLines = 0 // Allow for multiline text
77 +//
78 +// // Add label to the footer view
79 +// footerView.addSubview(footerLabel)
80 +// footerLabel.translatesAutoresizingMaskIntoConstraints = false
81 +//
82 +// // Set constraints for the label inside the footer view
83 +// NSLayoutConstraint.activate([
84 +// footerLabel.leadingAnchor.constraint(equalTo: footerView.leadingAnchor, constant: 16),
85 +// footerLabel.trailingAnchor.constraint(equalTo: footerView.trailingAnchor, constant: -16),
86 +// footerLabel.topAnchor.constraint(equalTo: footerView.topAnchor, constant: 10),
87 +// footerLabel.bottomAnchor.constraint(equalTo: footerView.bottomAnchor, constant: -10)
88 +// ])
89 +//
90 +// // Set the footer view's frame size to fit the content
91 +// footerView.frame = CGRect(x: 0, y: 0, width: tableView.frame.width, height: 50)
92 +//
93 +// // Assign the footer view to the table view's footer
94 +// tableView.tableFooterView = footerView
95 +// }
96 +
63 // MARK: - UIButton Actions 97 // MARK: - UIButton Actions
64 @IBAction func closeButtonAction(_ sender: Any) { 98 @IBAction func closeButtonAction(_ sender: Any) {
65 self.dismiss(animated: true, completion: {}) 99 self.dismiss(animated: true, completion: {})
...@@ -155,3 +189,23 @@ extension PopupMerchantsViewController: MerchantTableViewCellDelegate { ...@@ -155,3 +189,23 @@ extension PopupMerchantsViewController: MerchantTableViewCellDelegate {
155 } 189 }
156 190
157 } 191 }
192 +
193 +// Class for dynamic height table view
194 +@objc public class DynamicSizeMerchantsTableView: UITableView
195 +{
196 + override public func layoutSubviews() {
197 + super.layoutSubviews()
198 + if bounds.size != intrinsicContentSize {
199 + invalidateIntrinsicContentSize()
200 + }
201 + }
202 +
203 + // override public var intrinsicContentSize: CGSize {
204 + // return contentSize
205 + // }
206 +
207 + override public var intrinsicContentSize: CGSize {
208 + return CGSize(width: UIView.noIntrinsicMetric, height: contentSize.height + contentInset.top + contentInset.bottom + 30)
209 + }
210 +}
211 +
......