Dimitris Togias

add line in tabview

......@@ -6,12 +6,12 @@
//
import UIKit
import RESegmentedControl
@objc public class LoyaltyAnalysisViewController: UIViewController {
@IBOutlet weak var leftButton: UIButton!
@IBOutlet weak var rightButton: UIButton!
@IBOutlet weak var lineView: UIView!
@IBOutlet weak var contentView: UIView!
var pageController: UIPageViewController!
......@@ -33,6 +33,16 @@ import RESegmentedControl
rightButton.backgroundColor = . clear
rightButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal)
let gl = CAGradientLayer()
let colorLeft = UIColor(rgb: 0x1DA6B9).cgColor
let colorRight = UIColor(rgb: 0xB2CE69).cgColor
gl.colors = [colorLeft, colorRight]
gl.locations = [0.0, 1.0]
lineView.layer.addSublayer(gl)
let halfWidth = self.view.frame.width/2
lineView.frame = CGRect(x: 0, y: lineView.frame.minY, width: halfWidth, height: 2.0)
// pages
pageController = UIPageViewController(transitionStyle:.scroll, navigationOrientation:.horizontal)
pageController.dataSource = self;
......@@ -68,12 +78,20 @@ import RESegmentedControl
// MARK: - Handlers
@IBAction func handleLeft() {
UIView.animate(withDuration: 2.0, delay: 0.0) {
let halfWidth = self.view.frame.width/2
self.lineView.frame = CGRect(x: 0, y: self.lineView.frame.minY, width: halfWidth, height: 2.0)
}
let analysisVC = self.viewControllerAt(0)
pageController.setViewControllers([analysisVC!], direction:.reverse, animated:true)
}
@IBAction func handleRight() {
UIView.animate(withDuration: 2.0, delay: 0.0) {
let halfWidth = self.view.frame.width/2
self.lineView.frame = CGRect(x: halfWidth, y: self.lineView.frame.minY, width: halfWidth, height: 2.0)
}
let analysisVC = self.viewControllerAt(1)
pageController.setViewControllers([analysisVC!], direction:.forward, animated:true)
}
......
......@@ -430,6 +430,13 @@
<action selector="handleRight" destination="duB-b9-cnh" eventType="touchUpInside" id="bo6-x4-8Ld"/>
</connections>
</button>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f3E-Cc-8zN">
<rect key="frame" x="0.0" y="48" width="240" height="2"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="KlY-J5-5RO"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
......@@ -437,6 +444,7 @@
<constraint firstItem="liP-dN-sf3" firstAttribute="leading" secondItem="Z7V-En-7Tl" secondAttribute="leading" id="CRR-X1-VXy"/>
<constraint firstAttribute="trailing" secondItem="BNZ-3e-HXp" secondAttribute="trailing" id="FUC-Xt-vrx"/>
<constraint firstAttribute="bottom" secondItem="liP-dN-sf3" secondAttribute="bottom" id="HX4-Xg-GBR"/>
<constraint firstAttribute="bottom" secondItem="f3E-Cc-8zN" secondAttribute="bottom" id="Hyu-sp-nAT"/>
<constraint firstItem="liP-dN-sf3" firstAttribute="top" secondItem="Z7V-En-7Tl" secondAttribute="top" id="O5V-e5-NPf"/>
<constraint firstAttribute="height" constant="50" id="W4o-5O-kfL"/>
<constraint firstItem="BNZ-3e-HXp" firstAttribute="top" secondItem="Z7V-En-7Tl" secondAttribute="top" id="WtA-PL-BZy"/>
......@@ -467,6 +475,7 @@
<connections>
<outlet property="contentView" destination="FyK-3t-liP" id="lBC-DU-jIb"/>
<outlet property="leftButton" destination="liP-dN-sf3" id="PSM-x1-lPV"/>
<outlet property="lineView" destination="f3E-Cc-8zN" id="wqb-H2-aDz"/>
<outlet property="rightButton" destination="BNZ-3e-HXp" id="NDe-B7-wIV"/>
</connections>
</viewController>
......@@ -855,19 +864,19 @@
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="MCY-xv-vpg">
<rect key="frame" x="20" y="20" width="254" height="60.5"/>
<subviews>
<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">
<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">
<rect key="frame" x="0.0" y="0.0" width="254" height="21.5"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
<color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<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">
<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">
<rect key="frame" x="0.0" y="23.5" width="254" height="21.5"/>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="18"/>
<color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<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">
<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">
<rect key="frame" x="0.0" y="47" width="254" height="13.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/>
<color key="textColor" red="0.2274509804" green="0.32156862749999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
......