Manos Chorianopoulos

fix TelcoViewController ui

......@@ -2302,8 +2302,12 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8dQ-SF-Z4E">
<rect key="frame" x="0.0" y="44" width="414" height="852"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="coupons_scrollview_white" translatesAutoresizingMaskIntoConstraints="NO" id="6ch-LK-yKY">
<rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AUR-1f-OXi">
<rect key="frame" x="0.0" y="5" width="414" height="847"/>
<rect key="frame" x="0.0" y="2" width="414" height="850"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YmP-9y-EV0">
<rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
......@@ -2314,22 +2318,73 @@
<constraint firstAttribute="height" constant="200" id="v6r-oa-0XG"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7La-Zf-BX7">
<rect key="frame" x="20" y="220" width="70" height="70"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="G7w-Tk-Yfm">
<rect key="frame" x="10" y="25.5" width="50" height="19"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Medium" family="PF Square Sans Pro" pointSize="19"/>
<color key="textColor" red="0.13333333333333333" green="0.66274509803921566" blue="0.70980392156862748" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="3Uf-5S-KdI"/>
<constraint firstItem="G7w-Tk-Yfm" firstAttribute="leading" secondItem="7La-Zf-BX7" secondAttribute="leading" constant="10" id="DA1-Un-P7Y"/>
<constraint firstAttribute="height" constant="70" id="DIq-bh-Xza"/>
<constraint firstItem="G7w-Tk-Yfm" firstAttribute="centerY" secondItem="7La-Zf-BX7" secondAttribute="centerY" id="Gcm-sd-oIm"/>
<constraint firstItem="G7w-Tk-Yfm" firstAttribute="centerX" secondItem="7La-Zf-BX7" secondAttribute="centerX" id="HAp-Mg-ZHE"/>
<constraint firstAttribute="trailing" secondItem="G7w-Tk-Yfm" secondAttribute="trailing" constant="10" id="L9Q-bb-P3G"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yXI-Ds-V0T">
<rect key="frame" x="100" y="247.5" width="294" height="15"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Regular" family="PF Square Sans Pro" pointSize="15"/>
<color key="textColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7Bc-ly-ehN">
<rect key="frame" x="0.0" y="323" width="414" height="2"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="sgv-gT-iEr"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Xfg-Zl-DTT">
<rect key="frame" x="180.5" y="310" width="53.5" height="28"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vZf-KA-Yki">
<rect key="frame" x="10" y="8" width="33.5" height="15"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Regular" family="PF Square Sans Pro" pointSize="15"/>
<color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="vZf-KA-Yki" secondAttribute="trailing" constant="10" id="EK6-Mv-bxD"/>
<constraint firstItem="vZf-KA-Yki" firstAttribute="top" secondItem="Xfg-Zl-DTT" secondAttribute="top" constant="8" id="KXe-Oo-bS1"/>
<constraint firstAttribute="bottom" secondItem="vZf-KA-Yki" secondAttribute="bottom" constant="5" id="tjQ-ut-cqy"/>
<constraint firstItem="vZf-KA-Yki" firstAttribute="leading" secondItem="Xfg-Zl-DTT" secondAttribute="leading" constant="10" id="tzo-nt-cTZ"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="title" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XJ0-lK-2fk">
<rect key="frame" x="20" y="230" width="374" height="17"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Medium" family="PF Square Sans Pro" pointSize="17"/>
<rect key="frame" x="20" y="368" width="374" height="17"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Regular" family="PF Square Sans Pro" pointSize="17"/>
<color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="description" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Toi-hN-Bn7">
<rect key="frame" x="20" y="272" width="374" height="17"/>
<rect key="frame" x="20" y="410" width="374" height="17"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Regular" family="PF Square Sans Pro" pointSize="17"/>
<color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uDO-0Z-xFa">
<rect key="frame" x="83" y="389" width="248" height="50"/>
<rect key="frame" x="83" y="445" width="248" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="Mve-Wm-jeX"/>
<constraint firstAttribute="height" constant="40" id="Mve-Wm-jeX"/>
</constraints>
<fontDescription key="fontDescription" name="PFSquareSansPro-Medium" family="PF Square Sans Pro" pointSize="16"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
......@@ -2337,25 +2392,73 @@
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="activateButtomAction:" destination="lMR-D4-SOW" eventType="touchUpInside" id="emx-wy-PeW"/>
<action selector="activateButtomAction:" destination="lMR-D4-SOW" eventType="touchUpInside" id="Pab-FA-qhu"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ulI-Td-g6v">
<rect key="frame" x="103.5" y="495" width="207" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="72j-BL-Ejm"/>
</constraints>
<fontDescription key="fontDescription" name="PFSquareSansPro-Regular" family="PF Square Sans Pro" pointSize="16"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="5" maxY="0.0"/>
<state key="normal" title="Δες Περισσότερα" image="ic_down_dark">
<color key="titleColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<preferredSymbolConfiguration key="preferredSymbolConfiguration"/>
</state>
<connections>
<action selector="moreButtonAction:" destination="lMR-D4-SOW" eventType="touchUpInside" id="xW0-ds-4xL"/>
</connections>
</button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mCl-kM-ssj">
<rect key="frame" x="20" y="545" width="374" height="0.0"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" id="Uys-zo-ERe"/>
</constraints>
<color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Regular" family="PF Square Sans Pro" pointSize="13"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="Xfg-Zl-DTT" firstAttribute="centerX" secondItem="YmP-9y-EV0" secondAttribute="centerX" id="1RR-zs-8XM"/>
<constraint firstItem="QlP-ct-u6O" firstAttribute="top" secondItem="YmP-9y-EV0" secondAttribute="top" id="2z7-Gk-jiP"/>
<constraint firstItem="uDO-0Z-xFa" firstAttribute="centerX" secondItem="YmP-9y-EV0" secondAttribute="centerX" id="3jp-jm-qXu"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="ulI-Td-g6v" secondAttribute="bottom" constant="30" id="53n-kr-Q6B"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="mCl-kM-ssj" secondAttribute="bottom" constant="30" id="5nq-P2-bOH"/>
<constraint firstAttribute="trailing" secondItem="7Bc-ly-ehN" secondAttribute="trailing" id="7VM-tt-jqT"/>
<constraint firstItem="Xfg-Zl-DTT" firstAttribute="top" secondItem="7La-Zf-BX7" secondAttribute="bottom" constant="20" id="9sp-tg-Dk7"/>
<constraint firstItem="Toi-hN-Bn7" firstAttribute="top" secondItem="XJ0-lK-2fk" secondAttribute="bottom" constant="25" id="A5L-XB-0ef"/>
<constraint firstAttribute="trailing" secondItem="QlP-ct-u6O" secondAttribute="trailing" id="Bv6-ZV-dmS"/>
<constraint firstItem="XJ0-lK-2fk" firstAttribute="top" secondItem="QlP-ct-u6O" secondAttribute="bottom" constant="30" id="QVa-2f-1RG"/>
<constraint firstAttribute="trailing" secondItem="yXI-Ds-V0T" secondAttribute="trailing" constant="20" id="HrW-ZG-fgo"/>
<constraint firstAttribute="trailing" secondItem="mCl-kM-ssj" secondAttribute="trailing" constant="20" id="IT9-b1-n1C"/>
<constraint firstItem="mCl-kM-ssj" firstAttribute="leading" secondItem="YmP-9y-EV0" secondAttribute="leading" constant="20" id="KKR-28-Uov"/>
<constraint firstItem="yXI-Ds-V0T" firstAttribute="centerY" secondItem="7La-Zf-BX7" secondAttribute="centerY" id="NPi-C7-6J9"/>
<constraint firstItem="7La-Zf-BX7" firstAttribute="top" secondItem="QlP-ct-u6O" secondAttribute="bottom" constant="20" id="NiY-9G-88D"/>
<constraint firstItem="XJ0-lK-2fk" firstAttribute="top" secondItem="Xfg-Zl-DTT" secondAttribute="bottom" constant="30" id="QVa-2f-1RG"/>
<constraint firstItem="ulI-Td-g6v" firstAttribute="centerX" secondItem="YmP-9y-EV0" secondAttribute="centerX" id="VwY-kf-7fU"/>
<constraint firstItem="mCl-kM-ssj" firstAttribute="top" secondItem="ulI-Td-g6v" secondAttribute="bottom" constant="10" id="Yel-xv-ent"/>
<constraint firstAttribute="trailing" secondItem="XJ0-lK-2fk" secondAttribute="trailing" constant="20" id="cco-tR-YlH"/>
<constraint firstItem="7Bc-ly-ehN" firstAttribute="leading" secondItem="YmP-9y-EV0" secondAttribute="leading" id="jgD-2r-FeR"/>
<constraint firstItem="ulI-Td-g6v" firstAttribute="width" secondItem="YmP-9y-EV0" secondAttribute="width" multiplier="0.5" id="lT3-Qx-qTs"/>
<constraint firstItem="uDO-0Z-xFa" firstAttribute="width" secondItem="YmP-9y-EV0" secondAttribute="width" multiplier="0.6" id="mxO-XZ-O4t"/>
<constraint firstItem="uDO-0Z-xFa" firstAttribute="top" secondItem="Toi-hN-Bn7" secondAttribute="bottom" constant="100" id="oRo-i8-goh"/>
<constraint firstItem="uDO-0Z-xFa" firstAttribute="top" secondItem="XJ0-lK-2fk" secondAttribute="bottom" constant="60" id="oRo-i8-goh"/>
<constraint firstItem="XJ0-lK-2fk" firstAttribute="leading" secondItem="YmP-9y-EV0" secondAttribute="leading" constant="20" id="olo-Ei-uC2"/>
<constraint firstItem="QlP-ct-u6O" firstAttribute="leading" secondItem="YmP-9y-EV0" secondAttribute="leading" id="pwh-Uf-942"/>
<constraint firstAttribute="trailing" secondItem="Toi-hN-Bn7" secondAttribute="trailing" constant="20" id="rV1-Mg-rhg"/>
<constraint firstItem="ulI-Td-g6v" firstAttribute="top" secondItem="uDO-0Z-xFa" secondAttribute="bottom" constant="10" id="tfm-M4-2Ib"/>
<constraint firstItem="7La-Zf-BX7" firstAttribute="leading" secondItem="YmP-9y-EV0" secondAttribute="leading" constant="20" id="uzz-Wx-LMR"/>
<constraint firstItem="yXI-Ds-V0T" firstAttribute="leading" secondItem="7La-Zf-BX7" secondAttribute="trailing" constant="10" id="wV4-sO-FWF"/>
<constraint firstItem="7Bc-ly-ehN" firstAttribute="centerY" secondItem="Xfg-Zl-DTT" secondAttribute="centerY" id="x3N-iw-dch"/>
<constraint firstItem="Toi-hN-Bn7" firstAttribute="leading" secondItem="YmP-9y-EV0" secondAttribute="leading" constant="20" id="xyt-Bc-HTA"/>
</constraints>
<variation key="default">
<mask key="subviews">
<exclude reference="Toi-hN-Bn7"/>
</mask>
</variation>
</view>
</subviews>
<constraints>
......@@ -2389,14 +2492,23 @@
</constraints>
</view>
<connections>
<outlet property="activateButton" destination="uDO-0Z-xFa" id="7rK-iU-AKD"/>
<outlet property="descriptionLabel" destination="Toi-hN-Bn7" id="ayJ-bz-oz1"/>
<outlet property="heroImage" destination="QlP-ct-u6O" id="CEs-7T-KP7"/>
<outlet property="heroImageHeight" destination="v6r-oa-0XG" id="4wy-UN-qYB"/>
<outlet property="mainView" destination="8dQ-SF-Z4E" id="gUh-1a-Msg"/>
<outlet property="nameLabel" destination="XJ0-lK-2fk" id="67q-Es-R6T"/>
<outlet property="scrollContentView" destination="YmP-9y-EV0" id="rax-VX-dO0"/>
<outlet property="scrollView" destination="AUR-1f-OXi" id="ZEZ-CZ-8og"/>
<outlet property="activateButton" destination="uDO-0Z-xFa" id="EkA-Ab-l2x"/>
<outlet property="backgroundImage" destination="6ch-LK-yKY" id="g0Y-mW-Lxv"/>
<outlet property="borderLineView" destination="7Bc-ly-ehN" id="JFL-gS-QxZ"/>
<outlet property="descriptionLabel" destination="Toi-hN-Bn7" id="fMC-DH-36z"/>
<outlet property="giftDurationLabel" destination="vZf-KA-Yki" id="8DW-bF-Ryx"/>
<outlet property="giftDurationView" destination="Xfg-Zl-DTT" id="gAy-uL-zN7"/>
<outlet property="giftTypeLabel" destination="yXI-Ds-V0T" id="ux6-O8-GPe"/>
<outlet property="heroImage" destination="QlP-ct-u6O" id="lCm-UF-0Sy"/>
<outlet property="heroImageHeight" destination="v6r-oa-0XG" id="3Mg-z2-ETz"/>
<outlet property="moreButton" destination="ulI-Td-g6v" id="4Xj-S3-FzE"/>
<outlet property="moreTextView" destination="mCl-kM-ssj" id="cC6-pL-jqp"/>
<outlet property="moreTextViewHeight" destination="Uys-zo-ERe" id="W9H-V2-oOm"/>
<outlet property="nameLabel" destination="XJ0-lK-2fk" id="tL4-Ay-gb9"/>
<outlet property="scrollContentView" destination="YmP-9y-EV0" id="PLV-e9-qOd"/>
<outlet property="scrollView" destination="AUR-1f-OXi" id="u5N-8L-BVU"/>
<outlet property="valueLabel" destination="G7w-Tk-Yfm" id="9oX-f1-xS4"/>
<outlet property="valueView" destination="7La-Zf-BX7" id="Jeq-bO-HrK"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="UAL-zF-u8I" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
......
......@@ -9,6 +9,7 @@ import UIKit
@objc public class TelcoViewController: UIViewController, UIPopoverControllerDelegate {
@IBOutlet weak var mainView: UIView!
@IBOutlet weak var backgroundImage: UIImageView!
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var scrollContentView: UIView!
@IBOutlet weak var heroImage: UIImageView!
......@@ -16,6 +17,15 @@ import UIKit
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var activateButton: UIButton!
@IBOutlet weak var valueView: UIView!
@IBOutlet weak var valueLabel: UILabel!
@IBOutlet weak var giftTypeLabel: UILabel!
@IBOutlet weak var giftDurationView: UIView!
@IBOutlet weak var giftDurationLabel: UILabel!
@IBOutlet weak var borderLineView: UIView!
@IBOutlet weak var moreButton: UIButton!
@IBOutlet weak var moreTextView: UITextView!
@IBOutlet weak var moreTextViewHeight: NSLayoutConstraint!
let uiscreen: CGRect = UIScreen.main.bounds
......@@ -24,6 +34,8 @@ import UIKit
var selectedNumber: String = ""
public var numbersList: Array<String> = []
var moreVisible: Bool = false;
public override func viewDidLoad() {
super.viewDidLoad()
......@@ -33,27 +45,76 @@ import UIKit
// Do any additional setup after loading the view.
getProfileRequest()
setBackButton()
setNavigationTitle("Ενεργοποίηση")
setBackButton("ic_close")
setNavigationTitle(ccms?._titleOffer ?? "")
backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil)
scrollView.clipsToBounds = true
scrollView.layer.cornerRadius = 30
scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
heroImage.load(link: ccms?._imageUrl ?? "", placeholder: UIImage(), cache: URLCache())
heroImage.load(link: ccms?._imageOfferUrl ?? "", placeholder: UIImage(), cache: URLCache())
heroImage.contentMode = .scaleAspectFill
heroImageHeight.constant = self.uiscreen.height * 0.25
nameLabel.text = ccms?._title ?? ""
descriptionLabel.text = ccms?._subtitle ?? ""
nameLabel.text = ccms?._description ?? ""
// descriptionLabel.text = ccms?._subtitle ?? ""
valueView.gradientBorder(width: 1, colors: [UIColor(rgb: 0x07A2D1), UIColor(rgb: 0x73CA34)], startPoint: .unitCoordinate(.bottomLeft), endPoint: .unitCoordinate(.topRight), andRoundCornersWithRadius: 35)
valueLabel.text = ccms?._giftValue ?? ""
giftTypeLabel.text = ccms?._giftType ?? ""
giftDurationLabel.text = ccms?._duration ?? ""
giftDurationView.frame = CGRect(x: 0.0, y: 0.0, width: giftDurationLabel.intrinsicContentSize.width + 20, height: giftDurationView.frame.height)
giftDurationView.gradientBorder(width: 2, colors: [UIColor(rgb: 0x65DD6B), UIColor(rgb: 0x0D81B8)], startPoint: .unitCoordinate(.left), endPoint: .unitCoordinate(.right), andRoundCornersWithRadius: 35)
borderLineView.applyGradient(colours: [UIColor(rgb: 0x0AA3CD), UIColor(rgb: 0x6ECA43)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0)
activateButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16)
activateButton.setTitle("Ενεργοποίηση", for: .normal)
activateButton.setTitleColor(.white, for: .normal)
activateButton.backgroundColor = UIColor(red: 0.47, green: 0.75, blue: 0.08, alpha: 1.00)
activateButton.layer.cornerRadius = 12.0
moreButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 16)
// termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
moreButton.setTitle("Δες Περισσότερα", for: .normal)
moreButton.setTitleColor(UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00), for: .normal)
moreButton.setImage(UIImage(named: "ic_down_dark.png"), for: .normal)
// TODO: UNCOMMENT
// moreButton.setImage(UIImage(named: "ic_down_dark.png", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil), for: .normal)
moreButton.semanticContentAttribute = .forceRightToLeft
moreButton.tintColor = UIColor(red: 0.21, green: 0.32, blue: 0.41, alpha: 1.00)
moreButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0);
moreButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5);
// let htmlText = ccms?._description ?? ""
// moreTextView.attributedText = htmlText.htmlToAttributedString
moreTextView.text = ccms?._termsAndConditions ?? ""
moreTextView.font = UIFont(name: "PFSquareSansPro-Regular", size: 13)
moreTextView.textColor = UIColor(rgb: 0x415564)
// moreTextView.textAlignment = .center
moreTextView.isScrollEnabled = false
toggleMore()
}
// MARK: - Functions
func toggleMore() {
if (moreVisible) {
moreTextView.isHidden = false
let targetSize = CGSize(width: moreTextView.frame.width, height: CGFloat(MAXFLOAT))
moreTextViewHeight.constant = moreTextView.sizeThatFits(targetSize).height
moreButton.setImage(UIImage(named: "ic_up_dark.png", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil), for: .normal)
} else {
moreTextView.isHidden = true
moreTextViewHeight.constant = CGFloat(0)
moreButton.setImage(UIImage(named: "ic_down_dark.png", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil), for: .normal)
}
}
func showConfirmDialog() -> Void {
let alert = UIAlertController(title: "Ενεργοποίηση υπηρεσίας", message: "Θέλετε να γίνει ενεργοποίηση στο Κινητό μου;", preferredStyle: .alert)
......@@ -162,6 +223,11 @@ import UIKit
@IBAction func activateButtomAction(_ sender: Any) {
self.numbersPopupTapped(sender)
}
@IBAction func moreButtonAction(_ sender: Any) {
moreVisible = !moreVisible
toggleMore()
}
}
// MARK: NumbersPopup
......
......@@ -8,23 +8,33 @@
import UIKit
extension UIViewController {
func setBackButton() {
func setBackButton(_ icon:String = "ic_back") {
let uiscreen: CGRect = UIScreen.main.bounds
let backButton = UIButton(type: UIButton.ButtonType.custom) as UIButton
if (icon == "ic_close") {
backButton.frame = CGRect(x: 0, y: 0, width: uiscreen.height * 0.025, height: uiscreen.height * 0.025)
} else {
backButton.frame = CGRect(x: 0, y: 0, width: uiscreen.height * 0.025, height: uiscreen.height * 0.02)
}
backButton.imageView!.contentMode = .scaleAspectFit
//backButton.setBackgroundImage(UIImage(named:Assets.Navigation.backButton), for: UIControlState())
backButton.setImage(UIImage(named: "ic_back", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil), for: .normal)
backButton.setImage(UIImage(named: icon, in: Bundle(for: MyEmptyClass.self), compatibleWith: nil), for: .normal)
// backButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: -20, bottom: 0, right: 0)
backButton.addTarget(self, action: #selector(moveToBack(_:)), for: .touchUpInside)
backButton.translatesAutoresizingMaskIntoConstraints = false
// Add width, height constraints
if (icon == "ic_close") {
let widthContraints = NSLayoutConstraint(item: backButton, attribute: NSLayoutConstraint.Attribute.width, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: uiscreen.height * 0.025)
let heightContraints = NSLayoutConstraint(item: backButton, attribute: NSLayoutConstraint.Attribute.height, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: uiscreen.height * 0.025)
NSLayoutConstraint.activate([heightContraints,widthContraints])
} else {
let widthContraints = NSLayoutConstraint(item: backButton, attribute: NSLayoutConstraint.Attribute.width, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: uiscreen.height * 0.025)
let heightContraints = NSLayoutConstraint(item: backButton, attribute: NSLayoutConstraint.Attribute.height, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: uiscreen.height * 0.02)
NSLayoutConstraint.activate([heightContraints,widthContraints])
}
let leftBarButtonItem: UIBarButtonItem = UIBarButtonItem(customView: backButton)
self.navigationItem.setLeftBarButton(leftBarButtonItem, animated: false)
......@@ -217,3 +227,65 @@ extension UIFont {
return self.systemFont(ofSize: pointSize, weight: .medium)
}
}
public extension UIView {
private static let kLayerNameGradientBorder = "GradientBorderLayer"
func gradientBorder(width: CGFloat,
colors: [UIColor],
startPoint: CGPoint = CGPoint(x: 0.5, y: 0.0),
endPoint: CGPoint = CGPoint(x: 0.5, y: 1.0),
andRoundCornersWithRadius cornerRadius: CGFloat = 0) {
let existingBorder = gradientBorderLayer()
let border = existingBorder ?? CAGradientLayer()
border.frame = CGRect(x: bounds.origin.x, y: bounds.origin.y,
width: bounds.size.width + width, height: bounds.size.height + width)
border.colors = colors.map { return $0.cgColor }
border.startPoint = startPoint
border.endPoint = endPoint
let mask = CAShapeLayer()
let maskRect = CGRect(x: bounds.origin.x + width/2, y: bounds.origin.y + width/2,
width: bounds.size.width - width, height: bounds.size.height - width)
mask.path = UIBezierPath(roundedRect: maskRect, cornerRadius: cornerRadius).cgPath
mask.fillColor = UIColor.clear.cgColor
mask.strokeColor = UIColor.white.cgColor
mask.lineWidth = width
border.mask = mask
let exists = (existingBorder != nil)
if !exists {
layer.addSublayer(border)
}
}
private func gradientBorderLayer() -> CAGradientLayer? {
let borderLayers = layer.sublayers?.filter { return $0.name == UIView.kLayerNameGradientBorder }
if borderLayers?.count ?? 0 > 1 {
fatalError()
}
return borderLayers?.first as? CAGradientLayer
}
}
public extension CGPoint {
enum CoordinateSide {
case topLeft, top, topRight, right, bottomRight, bottom, bottomLeft, left
}
static func unitCoordinate(_ side: CoordinateSide) -> CGPoint {
switch side {
case .topLeft: return CGPoint(x: 0.0, y: 0.0)
case .top: return CGPoint(x: 0.5, y: 0.0)
case .topRight: return CGPoint(x: 1.0, y: 0.0)
case .right: return CGPoint(x: 0.0, y: 0.5)
case .bottomRight: return CGPoint(x: 1.0, y: 1.0)
case .bottom: return CGPoint(x: 0.5, y: 1.0)
case .bottomLeft: return CGPoint(x: 0.0, y: 1.0)
case .left: return CGPoint(x: 1.0, y: 0.5)
}
}
}
......