Dimitris Togias

add line in tabview

...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
6 // 6 //
7 7
8 import UIKit 8 import UIKit
9 -import RESegmentedControl
10 9
11 @objc public class LoyaltyAnalysisViewController: UIViewController { 10 @objc public class LoyaltyAnalysisViewController: UIViewController {
12 11
13 @IBOutlet weak var leftButton: UIButton! 12 @IBOutlet weak var leftButton: UIButton!
14 @IBOutlet weak var rightButton: UIButton! 13 @IBOutlet weak var rightButton: UIButton!
14 + @IBOutlet weak var lineView: UIView!
15 @IBOutlet weak var contentView: UIView! 15 @IBOutlet weak var contentView: UIView!
16 var pageController: UIPageViewController! 16 var pageController: UIPageViewController!
17 17
...@@ -33,6 +33,16 @@ import RESegmentedControl ...@@ -33,6 +33,16 @@ import RESegmentedControl
33 rightButton.backgroundColor = . clear 33 rightButton.backgroundColor = . clear
34 rightButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) 34 rightButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal)
35 35
36 +
37 + let gl = CAGradientLayer()
38 + let colorLeft = UIColor(rgb: 0x1DA6B9).cgColor
39 + let colorRight = UIColor(rgb: 0xB2CE69).cgColor
40 + gl.colors = [colorLeft, colorRight]
41 + gl.locations = [0.0, 1.0]
42 + lineView.layer.addSublayer(gl)
43 + let halfWidth = self.view.frame.width/2
44 + lineView.frame = CGRect(x: 0, y: lineView.frame.minY, width: halfWidth, height: 2.0)
45 +
36 // pages 46 // pages
37 pageController = UIPageViewController(transitionStyle:.scroll, navigationOrientation:.horizontal) 47 pageController = UIPageViewController(transitionStyle:.scroll, navigationOrientation:.horizontal)
38 pageController.dataSource = self; 48 pageController.dataSource = self;
...@@ -68,12 +78,20 @@ import RESegmentedControl ...@@ -68,12 +78,20 @@ import RESegmentedControl
68 // MARK: - Handlers 78 // MARK: - Handlers
69 @IBAction func handleLeft() { 79 @IBAction func handleLeft() {
70 80
81 + UIView.animate(withDuration: 2.0, delay: 0.0) {
82 + let halfWidth = self.view.frame.width/2
83 + self.lineView.frame = CGRect(x: 0, y: self.lineView.frame.minY, width: halfWidth, height: 2.0)
84 + }
71 let analysisVC = self.viewControllerAt(0) 85 let analysisVC = self.viewControllerAt(0)
72 pageController.setViewControllers([analysisVC!], direction:.reverse, animated:true) 86 pageController.setViewControllers([analysisVC!], direction:.reverse, animated:true)
73 } 87 }
74 88
75 @IBAction func handleRight() { 89 @IBAction func handleRight() {
76 90
91 + UIView.animate(withDuration: 2.0, delay: 0.0) {
92 + let halfWidth = self.view.frame.width/2
93 + self.lineView.frame = CGRect(x: halfWidth, y: self.lineView.frame.minY, width: halfWidth, height: 2.0)
94 + }
77 let analysisVC = self.viewControllerAt(1) 95 let analysisVC = self.viewControllerAt(1)
78 pageController.setViewControllers([analysisVC!], direction:.forward, animated:true) 96 pageController.setViewControllers([analysisVC!], direction:.forward, animated:true)
79 } 97 }
......
...@@ -430,6 +430,13 @@ ...@@ -430,6 +430,13 @@
430 <action selector="handleRight" destination="duB-b9-cnh" eventType="touchUpInside" id="bo6-x4-8Ld"/> 430 <action selector="handleRight" destination="duB-b9-cnh" eventType="touchUpInside" id="bo6-x4-8Ld"/>
431 </connections> 431 </connections>
432 </button> 432 </button>
433 + <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f3E-Cc-8zN">
434 + <rect key="frame" x="0.0" y="48" width="240" height="2"/>
435 + <color key="backgroundColor" systemColor="systemBackgroundColor"/>
436 + <constraints>
437 + <constraint firstAttribute="height" constant="2" id="KlY-J5-5RO"/>
438 + </constraints>
439 + </view>
433 </subviews> 440 </subviews>
434 <color key="backgroundColor" systemColor="systemBackgroundColor"/> 441 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
435 <constraints> 442 <constraints>
...@@ -437,6 +444,7 @@ ...@@ -437,6 +444,7 @@
437 <constraint firstItem="liP-dN-sf3" firstAttribute="leading" secondItem="Z7V-En-7Tl" secondAttribute="leading" id="CRR-X1-VXy"/> 444 <constraint firstItem="liP-dN-sf3" firstAttribute="leading" secondItem="Z7V-En-7Tl" secondAttribute="leading" id="CRR-X1-VXy"/>
438 <constraint firstAttribute="trailing" secondItem="BNZ-3e-HXp" secondAttribute="trailing" id="FUC-Xt-vrx"/> 445 <constraint firstAttribute="trailing" secondItem="BNZ-3e-HXp" secondAttribute="trailing" id="FUC-Xt-vrx"/>
439 <constraint firstAttribute="bottom" secondItem="liP-dN-sf3" secondAttribute="bottom" id="HX4-Xg-GBR"/> 446 <constraint firstAttribute="bottom" secondItem="liP-dN-sf3" secondAttribute="bottom" id="HX4-Xg-GBR"/>
447 + <constraint firstAttribute="bottom" secondItem="f3E-Cc-8zN" secondAttribute="bottom" id="Hyu-sp-nAT"/>
440 <constraint firstItem="liP-dN-sf3" firstAttribute="top" secondItem="Z7V-En-7Tl" secondAttribute="top" id="O5V-e5-NPf"/> 448 <constraint firstItem="liP-dN-sf3" firstAttribute="top" secondItem="Z7V-En-7Tl" secondAttribute="top" id="O5V-e5-NPf"/>
441 <constraint firstAttribute="height" constant="50" id="W4o-5O-kfL"/> 449 <constraint firstAttribute="height" constant="50" id="W4o-5O-kfL"/>
442 <constraint firstItem="BNZ-3e-HXp" firstAttribute="top" secondItem="Z7V-En-7Tl" secondAttribute="top" id="WtA-PL-BZy"/> 450 <constraint firstItem="BNZ-3e-HXp" firstAttribute="top" secondItem="Z7V-En-7Tl" secondAttribute="top" id="WtA-PL-BZy"/>
...@@ -467,6 +475,7 @@ ...@@ -467,6 +475,7 @@
467 <connections> 475 <connections>
468 <outlet property="contentView" destination="FyK-3t-liP" id="lBC-DU-jIb"/> 476 <outlet property="contentView" destination="FyK-3t-liP" id="lBC-DU-jIb"/>
469 <outlet property="leftButton" destination="liP-dN-sf3" id="PSM-x1-lPV"/> 477 <outlet property="leftButton" destination="liP-dN-sf3" id="PSM-x1-lPV"/>
478 + <outlet property="lineView" destination="f3E-Cc-8zN" id="wqb-H2-aDz"/>
470 <outlet property="rightButton" destination="BNZ-3e-HXp" id="NDe-B7-wIV"/> 479 <outlet property="rightButton" destination="BNZ-3e-HXp" id="NDe-B7-wIV"/>
471 </connections> 480 </connections>
472 </viewController> 481 </viewController>
...@@ -855,19 +864,19 @@ ...@@ -855,19 +864,19 @@
855 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="MCY-xv-vpg"> 864 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="MCY-xv-vpg">
856 <rect key="frame" x="20" y="20" width="254" height="60.5"/> 865 <rect key="frame" x="20" y="20" width="254" height="60.5"/>
857 <subviews> 866 <subviews>
858 - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Ενεργός κωδικός:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ucC-u4-AQL"> 867 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Ενεργός κωδικός:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ucC-u4-AQL">
859 <rect key="frame" x="0.0" y="0.0" width="254" height="21.5"/> 868 <rect key="frame" x="0.0" y="0.0" width="254" height="21.5"/>
860 <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/> 869 <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
861 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/> 870 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
862 <nil key="highlightedColor"/> 871 <nil key="highlightedColor"/>
863 </label> 872 </label>
864 - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="961544809" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qBe-Jw-QUx"> 873 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="961544809" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qBe-Jw-QUx">
865 <rect key="frame" x="0.0" y="23.5" width="254" height="21.5"/> 874 <rect key="frame" x="0.0" y="23.5" width="254" height="21.5"/>
866 <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="18"/> 875 <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="18"/>
867 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/> 876 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
868 <nil key="highlightedColor"/> 877 <nil key="highlightedColor"/>
869 </label> 878 </label>
870 - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Λήγει σε 4 ημέρες" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qL0-3b-eqA"> 879 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Λήγει σε 4 ημέρες" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qL0-3b-eqA">
871 <rect key="frame" x="0.0" y="47" width="254" height="13.5"/> 880 <rect key="frame" x="0.0" y="47" width="254" height="13.5"/>
872 <fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/> 881 <fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/>
873 <color key="textColor" red="0.2274509804" green="0.32156862749999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/> 882 <color key="textColor" red="0.2274509804" green="0.32156862749999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
......