Manos Chorianopoulos

CouponVC fixes

...@@ -26,7 +26,8 @@ import UIKit ...@@ -26,7 +26,8 @@ import UIKit
26 @IBOutlet weak var couponCodeContainerView: UIView! 26 @IBOutlet weak var couponCodeContainerView: UIView!
27 @IBOutlet weak var couponCodeHeaderView: UIView! 27 @IBOutlet weak var couponCodeHeaderView: UIView!
28 @IBOutlet weak var couponCodeContentView: UIView! 28 @IBOutlet weak var couponCodeContentView: UIView!
29 - 29 + @IBOutlet weak var couponCodeContainerViewHeight: NSLayoutConstraint!
30 +
30 // Header elements 31 // Header elements
31 @IBOutlet weak var couponCodeTitleLabel: UILabel! 32 @IBOutlet weak var couponCodeTitleLabel: UILabel!
32 @IBOutlet weak var couponCodeArrowImage: UIImageView! 33 @IBOutlet weak var couponCodeArrowImage: UIImageView!
...@@ -44,7 +45,8 @@ import UIKit ...@@ -44,7 +45,8 @@ import UIKit
44 @IBOutlet weak var couponQRContainerView: UIView! 45 @IBOutlet weak var couponQRContainerView: UIView!
45 @IBOutlet weak var couponQRHeaderView: UIView! 46 @IBOutlet weak var couponQRHeaderView: UIView!
46 @IBOutlet weak var couponQRContentView: UIView! 47 @IBOutlet weak var couponQRContentView: UIView!
47 - 48 + @IBOutlet weak var couponQRContainerViewHeight: NSLayoutConstraint!
49 +
48 // Header elements 50 // Header elements
49 @IBOutlet weak var couponQRTitleLabel: UILabel! 51 @IBOutlet weak var couponQRTitleLabel: UILabel!
50 @IBOutlet weak var couponQRArrowImage: UIImageView! 52 @IBOutlet weak var couponQRArrowImage: UIImageView!
...@@ -105,12 +107,16 @@ import UIKit ...@@ -105,12 +107,16 @@ import UIKit
105 couponCodeContainerView.clipsToBounds = true 107 couponCodeContainerView.clipsToBounds = true
106 couponCodeButton.addTarget(self, action: #selector(toggleCouponCode), for: .touchUpInside) 108 couponCodeButton.addTarget(self, action: #selector(toggleCouponCode), for: .touchUpInside)
107 couponCodeContentHeightConstraint.constant = 0 109 couponCodeContentHeightConstraint.constant = 0
110 + couponCodeContentView.isHidden = true
111 + couponCodeContainerViewHeight.constant = couponCodeContainerView.intrinsicContentSize.height
108 112
109 couponQRContainerView.backgroundColor = UIColor(rgb: 0xFFFFFF) 113 couponQRContainerView.backgroundColor = UIColor(rgb: 0xFFFFFF)
110 couponQRContainerView.layer.cornerRadius = 8.0 114 couponQRContainerView.layer.cornerRadius = 8.0
111 couponQRContainerView.clipsToBounds = true 115 couponQRContainerView.clipsToBounds = true
112 couponQRButton.addTarget(self, action: #selector(toggleCouponQR), for: .touchUpInside) 116 couponQRButton.addTarget(self, action: #selector(toggleCouponQR), for: .touchUpInside)
113 couponQRContentHeightConstraint.constant = 0 117 couponQRContentHeightConstraint.constant = 0
118 + couponQRContentView.isHidden = true
119 + couponQRContainerViewHeight.constant = couponQRContainerView.intrinsicContentSize.height
114 120
115 termsButtonTitleLabel.font = UIFont(name: "PingLCG-Bold", size: 16) 121 termsButtonTitleLabel.font = UIFont(name: "PingLCG-Bold", size: 16)
116 termsButtonTitleLabel.textColor = UIColor(rgb: 0x020E1C) 122 termsButtonTitleLabel.textColor = UIColor(rgb: 0x020E1C)
...@@ -202,7 +208,7 @@ import UIKit ...@@ -202,7 +208,7 @@ import UIKit
202 self.couponCodeArrowImage.image = UIImage(named: self.isCouponCodeExpanded ? "arrow_up" : "arrow_down", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 208 self.couponCodeArrowImage.image = UIImage(named: self.isCouponCodeExpanded ? "arrow_up" : "arrow_down", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
203 self.couponCodeContentHeightConstraint.constant = self.isCouponCodeExpanded ? self.couponCodeContentView.intrinsicContentSize.height : 0 209 self.couponCodeContentHeightConstraint.constant = self.isCouponCodeExpanded ? self.couponCodeContentView.intrinsicContentSize.height : 0
204 self.couponCodeContentView.isHidden = !self.isCouponCodeExpanded 210 self.couponCodeContentView.isHidden = !self.isCouponCodeExpanded
205 - self.couponCodeContainerView.frame.size.height = self.couponCodeContainerView.intrinsicContentSize.height 211 + self.couponCodeContainerViewHeight.constant = self.couponCodeContainerView.intrinsicContentSize.height
206 self.view.layoutIfNeeded() 212 self.view.layoutIfNeeded()
207 } 213 }
208 } 214 }
...@@ -214,7 +220,7 @@ import UIKit ...@@ -214,7 +220,7 @@ import UIKit
214 self.couponQRArrowImage.image = UIImage(named: self.isCouponQRExpanded ? "arrow_up" : "arrow_down", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 220 self.couponQRArrowImage.image = UIImage(named: self.isCouponQRExpanded ? "arrow_up" : "arrow_down", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
215 self.couponQRContentHeightConstraint.constant = self.isCouponQRExpanded ? self.couponQRContentView.intrinsicContentSize.height : 0 221 self.couponQRContentHeightConstraint.constant = self.isCouponQRExpanded ? self.couponQRContentView.intrinsicContentSize.height : 0
216 self.couponQRContentView.isHidden = !self.isCouponQRExpanded 222 self.couponQRContentView.isHidden = !self.isCouponQRExpanded
217 - self.couponQRContainerView.frame.size.height = self.couponQRContainerView.intrinsicContentSize.height 223 + self.couponQRContainerViewHeight.constant = self.couponQRContainerView.intrinsicContentSize.height
218 self.view.layoutIfNeeded() 224 self.view.layoutIfNeeded()
219 } 225 }
220 } 226 }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
15 <outlet property="couponCodeArrowImage" destination="YoJ-w2-mm9" id="oQm-Mm-FL8"/> 15 <outlet property="couponCodeArrowImage" destination="YoJ-w2-mm9" id="oQm-Mm-FL8"/>
16 <outlet property="couponCodeButton" destination="5sx-2G-cCM" id="vuv-NX-y5I"/> 16 <outlet property="couponCodeButton" destination="5sx-2G-cCM" id="vuv-NX-y5I"/>
17 <outlet property="couponCodeContainerView" destination="ElJ-Te-N4M" id="84s-Ab-iAG"/> 17 <outlet property="couponCodeContainerView" destination="ElJ-Te-N4M" id="84s-Ab-iAG"/>
18 + <outlet property="couponCodeContainerViewHeight" destination="z8d-Ki-jJz" id="Mtb-K9-4Mj"/>
18 <outlet property="couponCodeContentHeightConstraint" destination="ky8-Xs-cjh" id="P1b-xY-vde"/> 19 <outlet property="couponCodeContentHeightConstraint" destination="ky8-Xs-cjh" id="P1b-xY-vde"/>
19 <outlet property="couponCodeContentView" destination="wT1-HY-mg9" id="PEK-wT-l4v"/> 20 <outlet property="couponCodeContentView" destination="wT1-HY-mg9" id="PEK-wT-l4v"/>
20 <outlet property="couponCodeHeaderView" destination="cTO-BG-Gzi" id="6Xm-p8-F13"/> 21 <outlet property="couponCodeHeaderView" destination="cTO-BG-Gzi" id="6Xm-p8-F13"/>
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
24 <outlet property="couponQRArrowImage" destination="OXW-Jx-8wp" id="ijU-6O-hcN"/> 25 <outlet property="couponQRArrowImage" destination="OXW-Jx-8wp" id="ijU-6O-hcN"/>
25 <outlet property="couponQRButton" destination="xd4-3b-eOl" id="ElE-cn-nPX"/> 26 <outlet property="couponQRButton" destination="xd4-3b-eOl" id="ElE-cn-nPX"/>
26 <outlet property="couponQRContainerView" destination="Cwz-uh-Zn5" id="igH-cb-FMa"/> 27 <outlet property="couponQRContainerView" destination="Cwz-uh-Zn5" id="igH-cb-FMa"/>
28 + <outlet property="couponQRContainerViewHeight" destination="KLs-q8-eNp" id="WoC-Xo-Dyu"/>
27 <outlet property="couponQRContentHeightConstraint" destination="odW-jh-UiA" id="LfK-Hl-1Ks"/> 29 <outlet property="couponQRContentHeightConstraint" destination="odW-jh-UiA" id="LfK-Hl-1Ks"/>
28 <outlet property="couponQRContentView" destination="xqU-7k-Vxg" id="t1n-V2-Tv3"/> 30 <outlet property="couponQRContentView" destination="xqU-7k-Vxg" id="t1n-V2-Tv3"/>
29 <outlet property="couponQRHeaderView" destination="eEy-8l-te2" id="0U3-5V-9BB"/> 31 <outlet property="couponQRHeaderView" destination="eEy-8l-te2" id="0U3-5V-9BB"/>
...@@ -231,6 +233,7 @@ ...@@ -231,6 +233,7 @@
231 <constraint firstAttribute="trailing" secondItem="wT1-HY-mg9" secondAttribute="trailing" id="ssf-Xv-Bxx"/> 233 <constraint firstAttribute="trailing" secondItem="wT1-HY-mg9" secondAttribute="trailing" id="ssf-Xv-Bxx"/>
232 <constraint firstAttribute="trailing" secondItem="cTO-BG-Gzi" secondAttribute="trailing" id="umy-qN-JFu"/> 234 <constraint firstAttribute="trailing" secondItem="cTO-BG-Gzi" secondAttribute="trailing" id="umy-qN-JFu"/>
233 <constraint firstItem="wT1-HY-mg9" firstAttribute="top" secondItem="cTO-BG-Gzi" secondAttribute="bottom" id="wkk-WM-rVY"/> 235 <constraint firstItem="wT1-HY-mg9" firstAttribute="top" secondItem="cTO-BG-Gzi" secondAttribute="bottom" id="wkk-WM-rVY"/>
236 + <constraint firstAttribute="height" constant="183" id="z8d-Ki-jJz"/>
234 </constraints> 237 </constraints>
235 </view> 238 </view>
236 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Cwz-uh-Zn5" userLabel="CouponQRContainerView"> 239 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Cwz-uh-Zn5" userLabel="CouponQRContainerView">
...@@ -301,6 +304,7 @@ ...@@ -301,6 +304,7 @@
301 <constraints> 304 <constraints>
302 <constraint firstAttribute="trailing" secondItem="xqU-7k-Vxg" secondAttribute="trailing" id="JEa-Zg-JIu"/> 305 <constraint firstAttribute="trailing" secondItem="xqU-7k-Vxg" secondAttribute="trailing" id="JEa-Zg-JIu"/>
303 <constraint firstItem="xqU-7k-Vxg" firstAttribute="top" secondItem="eEy-8l-te2" secondAttribute="bottom" id="Jf6-P1-9qS"/> 306 <constraint firstItem="xqU-7k-Vxg" firstAttribute="top" secondItem="eEy-8l-te2" secondAttribute="bottom" id="Jf6-P1-9qS"/>
307 + <constraint firstAttribute="height" constant="305" id="KLs-q8-eNp"/>
304 <constraint firstItem="eEy-8l-te2" firstAttribute="leading" secondItem="Cwz-uh-Zn5" secondAttribute="leading" id="iZp-kc-tZ2"/> 308 <constraint firstItem="eEy-8l-te2" firstAttribute="leading" secondItem="Cwz-uh-Zn5" secondAttribute="leading" id="iZp-kc-tZ2"/>
305 <constraint firstItem="xqU-7k-Vxg" firstAttribute="leading" secondItem="Cwz-uh-Zn5" secondAttribute="leading" id="nxQ-kb-BhT"/> 309 <constraint firstItem="xqU-7k-Vxg" firstAttribute="leading" secondItem="Cwz-uh-Zn5" secondAttribute="leading" id="nxQ-kb-BhT"/>
306 <constraint firstItem="eEy-8l-te2" firstAttribute="top" secondItem="Cwz-uh-Zn5" secondAttribute="top" id="qho-3x-oyY"/> 310 <constraint firstItem="eEy-8l-te2" firstAttribute="top" secondItem="Cwz-uh-Zn5" secondAttribute="top" id="qho-3x-oyY"/>
......