Manos Chorianopoulos

CouponVC fixes

......@@ -26,7 +26,8 @@ import UIKit
@IBOutlet weak var couponCodeContainerView: UIView!
@IBOutlet weak var couponCodeHeaderView: UIView!
@IBOutlet weak var couponCodeContentView: UIView!
@IBOutlet weak var couponCodeContainerViewHeight: NSLayoutConstraint!
// Header elements
@IBOutlet weak var couponCodeTitleLabel: UILabel!
@IBOutlet weak var couponCodeArrowImage: UIImageView!
......@@ -44,7 +45,8 @@ import UIKit
@IBOutlet weak var couponQRContainerView: UIView!
@IBOutlet weak var couponQRHeaderView: UIView!
@IBOutlet weak var couponQRContentView: UIView!
@IBOutlet weak var couponQRContainerViewHeight: NSLayoutConstraint!
// Header elements
@IBOutlet weak var couponQRTitleLabel: UILabel!
@IBOutlet weak var couponQRArrowImage: UIImageView!
......@@ -105,12 +107,16 @@ import UIKit
couponCodeContainerView.clipsToBounds = true
couponCodeButton.addTarget(self, action: #selector(toggleCouponCode), for: .touchUpInside)
couponCodeContentHeightConstraint.constant = 0
couponCodeContentView.isHidden = true
couponCodeContainerViewHeight.constant = couponCodeContainerView.intrinsicContentSize.height
couponQRContainerView.backgroundColor = UIColor(rgb: 0xFFFFFF)
couponQRContainerView.layer.cornerRadius = 8.0
couponQRContainerView.clipsToBounds = true
couponQRButton.addTarget(self, action: #selector(toggleCouponQR), for: .touchUpInside)
couponQRContentHeightConstraint.constant = 0
couponQRContentView.isHidden = true
couponQRContainerViewHeight.constant = couponQRContainerView.intrinsicContentSize.height
termsButtonTitleLabel.font = UIFont(name: "PingLCG-Bold", size: 16)
termsButtonTitleLabel.textColor = UIColor(rgb: 0x020E1C)
......@@ -202,7 +208,7 @@ import UIKit
self.couponCodeArrowImage.image = UIImage(named: self.isCouponCodeExpanded ? "arrow_up" : "arrow_down", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
self.couponCodeContentHeightConstraint.constant = self.isCouponCodeExpanded ? self.couponCodeContentView.intrinsicContentSize.height : 0
self.couponCodeContentView.isHidden = !self.isCouponCodeExpanded
self.couponCodeContainerView.frame.size.height = self.couponCodeContainerView.intrinsicContentSize.height
self.couponCodeContainerViewHeight.constant = self.couponCodeContainerView.intrinsicContentSize.height
self.view.layoutIfNeeded()
}
}
......@@ -214,7 +220,7 @@ import UIKit
self.couponQRArrowImage.image = UIImage(named: self.isCouponQRExpanded ? "arrow_up" : "arrow_down", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
self.couponQRContentHeightConstraint.constant = self.isCouponQRExpanded ? self.couponQRContentView.intrinsicContentSize.height : 0
self.couponQRContentView.isHidden = !self.isCouponQRExpanded
self.couponQRContainerView.frame.size.height = self.couponQRContainerView.intrinsicContentSize.height
self.couponQRContainerViewHeight.constant = self.couponQRContainerView.intrinsicContentSize.height
self.view.layoutIfNeeded()
}
}
......
......@@ -15,6 +15,7 @@
<outlet property="couponCodeArrowImage" destination="YoJ-w2-mm9" id="oQm-Mm-FL8"/>
<outlet property="couponCodeButton" destination="5sx-2G-cCM" id="vuv-NX-y5I"/>
<outlet property="couponCodeContainerView" destination="ElJ-Te-N4M" id="84s-Ab-iAG"/>
<outlet property="couponCodeContainerViewHeight" destination="z8d-Ki-jJz" id="Mtb-K9-4Mj"/>
<outlet property="couponCodeContentHeightConstraint" destination="ky8-Xs-cjh" id="P1b-xY-vde"/>
<outlet property="couponCodeContentView" destination="wT1-HY-mg9" id="PEK-wT-l4v"/>
<outlet property="couponCodeHeaderView" destination="cTO-BG-Gzi" id="6Xm-p8-F13"/>
......@@ -24,6 +25,7 @@
<outlet property="couponQRArrowImage" destination="OXW-Jx-8wp" id="ijU-6O-hcN"/>
<outlet property="couponQRButton" destination="xd4-3b-eOl" id="ElE-cn-nPX"/>
<outlet property="couponQRContainerView" destination="Cwz-uh-Zn5" id="igH-cb-FMa"/>
<outlet property="couponQRContainerViewHeight" destination="KLs-q8-eNp" id="WoC-Xo-Dyu"/>
<outlet property="couponQRContentHeightConstraint" destination="odW-jh-UiA" id="LfK-Hl-1Ks"/>
<outlet property="couponQRContentView" destination="xqU-7k-Vxg" id="t1n-V2-Tv3"/>
<outlet property="couponQRHeaderView" destination="eEy-8l-te2" id="0U3-5V-9BB"/>
......@@ -231,6 +233,7 @@
<constraint firstAttribute="trailing" secondItem="wT1-HY-mg9" secondAttribute="trailing" id="ssf-Xv-Bxx"/>
<constraint firstAttribute="trailing" secondItem="cTO-BG-Gzi" secondAttribute="trailing" id="umy-qN-JFu"/>
<constraint firstItem="wT1-HY-mg9" firstAttribute="top" secondItem="cTO-BG-Gzi" secondAttribute="bottom" id="wkk-WM-rVY"/>
<constraint firstAttribute="height" constant="183" id="z8d-Ki-jJz"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Cwz-uh-Zn5" userLabel="CouponQRContainerView">
......@@ -301,6 +304,7 @@
<constraints>
<constraint firstAttribute="trailing" secondItem="xqU-7k-Vxg" secondAttribute="trailing" id="JEa-Zg-JIu"/>
<constraint firstItem="xqU-7k-Vxg" firstAttribute="top" secondItem="eEy-8l-te2" secondAttribute="bottom" id="Jf6-P1-9qS"/>
<constraint firstAttribute="height" constant="305" id="KLs-q8-eNp"/>
<constraint firstItem="eEy-8l-te2" firstAttribute="leading" secondItem="Cwz-uh-Zn5" secondAttribute="leading" id="iZp-kc-tZ2"/>
<constraint firstItem="xqU-7k-Vxg" firstAttribute="leading" secondItem="Cwz-uh-Zn5" secondAttribute="leading" id="nxQ-kb-BhT"/>
<constraint firstItem="eEy-8l-te2" firstAttribute="top" secondItem="Cwz-uh-Zn5" secondAttribute="top" id="qho-3x-oyY"/>
......