Showing
5 changed files
with
76 additions
and
34 deletions
No preview for this file type
| ... | @@ -30,13 +30,34 @@ class AnalysisHeaderMessageViewCell: UITableViewCell { | ... | @@ -30,13 +30,34 @@ class AnalysisHeaderMessageViewCell: UITableViewCell { |
| 30 | // message | 30 | // message |
| 31 | messageLabel.textColor = UIColor(rgb: 0x435563) | 31 | messageLabel.textColor = UIColor(rgb: 0x435563) |
| 32 | messageLabel.layer.borderWidth = 1.0 | 32 | messageLabel.layer.borderWidth = 1.0 |
| 33 | - messageLabel.layer.borderColor = UIColor(rgb: 0xB2CE69).cgColor | 33 | + messageLabel.layer.borderColor = UIColor(rgb: 0x1DA6B9).cgColor |
| 34 | 34 | ||
| 35 | let totalCouponDiscount = Float(round(100 * loyaltyBadge._value) / 100) | 35 | let totalCouponDiscount = Float(round(100 * loyaltyBadge._value) / 100) |
| 36 | var totalCouponDiscountString = "0" | 36 | var totalCouponDiscountString = "0" |
| 37 | totalCouponDiscountString = String(format: "%.2f", totalCouponDiscount).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | 37 | totalCouponDiscountString = String(format: "%.2f", totalCouponDiscount).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) |
| 38 | 38 | ||
| 39 | - messageLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(loyaltyBadge._couponCount) + " κουπόνια!" | 39 | +// messageLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(loyaltyBadge._couponCount) + " κουπόνια!" |
| 40 | + | ||
| 41 | + let coupNormalText1 = "Μέχρι τώρα έχεις κερδίσει " | ||
| 42 | + let coupBoldText = totalCouponDiscountString + "€" | ||
| 43 | + let coupNormalText2 = " σε προσφορές από " | ||
| 44 | + let coupBoldText2 = String(loyaltyBadge._couponCount) | ||
| 45 | + let coupNormalText3 = " κουπόνια!" | ||
| 46 | + | ||
| 47 | + let attrRegular = [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16)] | ||
| 48 | + let attrBold = [NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 16)] | ||
| 49 | + | ||
| 50 | + let coupAttributedString = NSMutableAttributedString(string:coupNormalText1, attributes:attrRegular) | ||
| 51 | + let coupBoldString = NSMutableAttributedString(string: coupBoldText, attributes:attrBold) | ||
| 52 | + let coupNormalString2 = NSMutableAttributedString(string:coupNormalText2, attributes:attrRegular) | ||
| 53 | + let coupBoldString2 = NSMutableAttributedString(string: coupBoldText2, attributes:attrBold) | ||
| 54 | + let coupNormalString3 = NSMutableAttributedString(string:coupNormalText3, attributes:attrRegular) | ||
| 55 | + | ||
| 56 | + coupAttributedString.append(coupBoldString) | ||
| 57 | + coupAttributedString.append(coupNormalString2) | ||
| 58 | + coupAttributedString.append(coupBoldString2) | ||
| 59 | + coupAttributedString.append(coupNormalString3) | ||
| 60 | + messageLabel.attributedText = coupAttributedString | ||
| 40 | } | 61 | } |
| 41 | } | 62 | } |
| 42 | 63 | ... | ... |
| ... | @@ -11,9 +11,11 @@ import UIKit | ... | @@ -11,9 +11,11 @@ import UIKit |
| 11 | 11 | ||
| 12 | @IBOutlet weak var leftButton: UIButton! | 12 | @IBOutlet weak var leftButton: UIButton! |
| 13 | @IBOutlet weak var rightButton: UIButton! | 13 | @IBOutlet weak var rightButton: UIButton! |
| 14 | - @IBOutlet weak var lineView: UIView! | 14 | + @IBOutlet weak var leftLineView: UIView! |
| 15 | + @IBOutlet weak var rightLineView: UIView! | ||
| 15 | @IBOutlet weak var contentView: UIView! | 16 | @IBOutlet weak var contentView: UIView! |
| 16 | var pageController: UIPageViewController! | 17 | var pageController: UIPageViewController! |
| 18 | + var tabSelected = 0 | ||
| 17 | 19 | ||
| 18 | public override func viewDidLoad() { | 20 | public override func viewDidLoad() { |
| 19 | super.viewDidLoad() | 21 | super.viewDidLoad() |
| ... | @@ -25,23 +27,21 @@ import UIKit | ... | @@ -25,23 +27,21 @@ import UIKit |
| 25 | setNavigationTitle("Ανάλυση") | 27 | setNavigationTitle("Ανάλυση") |
| 26 | 28 | ||
| 27 | // tab | 29 | // tab |
| 30 | + leftButton.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: .regular) | ||
| 28 | leftButton.setTitle("Εξαργυρωμένα", for:.normal) | 31 | leftButton.setTitle("Εξαργυρωμένα", for:.normal) |
| 29 | leftButton.backgroundColor = . clear | 32 | leftButton.backgroundColor = . clear |
| 30 | leftButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) | 33 | leftButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) |
| 31 | 34 | ||
| 35 | + rightButton.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: .regular) | ||
| 32 | rightButton.setTitle("Μοιρασμένα δώρα", for:.normal) | 36 | rightButton.setTitle("Μοιρασμένα δώρα", for:.normal) |
| 33 | rightButton.backgroundColor = . clear | 37 | rightButton.backgroundColor = . clear |
| 34 | - rightButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) | 38 | + rightButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal) |
| 35 | 39 | ||
| 40 | + leftLineView.applyGradient(colours: [UIColor(rgb: 0x1DA6B9), UIColor(rgb: 0xB2CE69)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0) | ||
| 41 | + rightLineView.applyGradient(colours: [UIColor(rgb: 0x1DA6B9), UIColor(rgb: 0xB2CE69)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0) | ||
| 36 | 42 | ||
| 37 | - let gl = CAGradientLayer() | 43 | + leftLineView.isHidden = false |
| 38 | - let colorLeft = UIColor(rgb: 0x1DA6B9).cgColor | 44 | + rightLineView.isHidden = true |
| 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 | 45 | ||
| 46 | // pages | 46 | // pages |
| 47 | pageController = UIPageViewController(transitionStyle:.scroll, navigationOrientation:.horizontal) | 47 | pageController = UIPageViewController(transitionStyle:.scroll, navigationOrientation:.horizontal) |
| ... | @@ -77,23 +77,37 @@ import UIKit | ... | @@ -77,23 +77,37 @@ import UIKit |
| 77 | 77 | ||
| 78 | // MARK: - Handlers | 78 | // MARK: - Handlers |
| 79 | @IBAction func handleLeft() { | 79 | @IBAction func handleLeft() { |
| 80 | - | 80 | + if (tabSelected != 0) { |
| 81 | - UIView.animate(withDuration: 2.0, delay: 0.0) { | 81 | + self.tabSelected = 0 |
| 82 | - let halfWidth = self.view.frame.width/2 | 82 | + |
| 83 | - self.lineView.frame = CGRect(x: 0, y: self.lineView.frame.minY, width: halfWidth, height: 2.0) | 83 | + UIView.animate(withDuration: 2.0, delay: 0.0) { |
| 84 | + | ||
| 85 | + self.leftLineView.isHidden = false | ||
| 86 | + self.rightLineView.isHidden = true | ||
| 87 | + | ||
| 88 | + self.leftButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) | ||
| 89 | + self.rightButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal) | ||
| 90 | + } | ||
| 91 | + let analysisVC = self.viewControllerAt(0) | ||
| 92 | + pageController.setViewControllers([analysisVC!], direction:.reverse, animated:true) | ||
| 84 | } | 93 | } |
| 85 | - let analysisVC = self.viewControllerAt(0) | ||
| 86 | - pageController.setViewControllers([analysisVC!], direction:.reverse, animated:true) | ||
| 87 | } | 94 | } |
| 88 | 95 | ||
| 89 | @IBAction func handleRight() { | 96 | @IBAction func handleRight() { |
| 90 | - | 97 | + if (tabSelected != 1) { |
| 91 | - UIView.animate(withDuration: 2.0, delay: 0.0) { | 98 | + self.tabSelected = 1 |
| 92 | - let halfWidth = self.view.frame.width/2 | 99 | + |
| 93 | - self.lineView.frame = CGRect(x: halfWidth, y: self.lineView.frame.minY, width: halfWidth, height: 2.0) | 100 | + UIView.animate(withDuration: 2.0, delay: 0.0) { |
| 101 | + | ||
| 102 | + self.leftLineView.isHidden = true | ||
| 103 | + self.rightLineView.isHidden = false | ||
| 104 | + | ||
| 105 | + self.rightButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) | ||
| 106 | + self.leftButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal) | ||
| 107 | + } | ||
| 108 | + let analysisVC = self.viewControllerAt(1) | ||
| 109 | + pageController.setViewControllers([analysisVC!], direction:.forward, animated:true) | ||
| 94 | } | 110 | } |
| 95 | - let analysisVC = self.viewControllerAt(1) | ||
| 96 | - pageController.setViewControllers([analysisVC!], direction:.forward, animated:true) | ||
| 97 | } | 111 | } |
| 98 | } | 112 | } |
| 99 | 113 | ||
| ... | @@ -104,26 +118,26 @@ extension LoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageV | ... | @@ -104,26 +118,26 @@ extension LoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageV |
| 104 | 118 | ||
| 105 | if let analysisVC = viewController as? AnalysisChildViewController { | 119 | if let analysisVC = viewController as? AnalysisChildViewController { |
| 106 | var index = analysisVC.index | 120 | var index = analysisVC.index |
| 107 | - if (index == 1) { | 121 | + if (index == 0) { |
| 108 | return nil; | 122 | return nil; |
| 109 | } | 123 | } |
| 110 | 124 | ||
| 111 | - index += 1; | 125 | + index -= 1; |
| 112 | return viewControllerAt(index); | 126 | return viewControllerAt(index); |
| 113 | } | 127 | } |
| 114 | 128 | ||
| 115 | return nil; | 129 | return nil; |
| 116 | } | 130 | } |
| 117 | 131 | ||
| 118 | - public func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? { | 132 | + public func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? { |
| 119 | 133 | ||
| 120 | if let analysisVC = viewController as? AnalysisChildViewController { | 134 | if let analysisVC = viewController as? AnalysisChildViewController { |
| 121 | var index = analysisVC.index | 135 | var index = analysisVC.index |
| 122 | - if (index == 0) { | 136 | + if (index == 1) { |
| 123 | return nil; | 137 | return nil; |
| 124 | } | 138 | } |
| 125 | 139 | ||
| 126 | - index -= 1; | 140 | + index += 1; |
| 127 | return viewControllerAt(index); | 141 | return viewControllerAt(index); |
| 128 | } | 142 | } |
| 129 | 143 | ||
| ... | @@ -141,11 +155,18 @@ extension LoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageV | ... | @@ -141,11 +155,18 @@ extension LoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageV |
| 141 | if let childVCs = pageViewController.viewControllers as? [AnalysisChildViewController] { | 155 | if let childVCs = pageViewController.viewControllers as? [AnalysisChildViewController] { |
| 142 | let currentIndex = childVCs[0].index | 156 | let currentIndex = childVCs[0].index |
| 143 | if (currentIndex == 0) { | 157 | if (currentIndex == 0) { |
| 144 | - leftButton.isSelected = true | 158 | + self.leftButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) |
| 145 | - rightButton.isSelected = false | 159 | + self.rightButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal) |
| 160 | + self.tabSelected = 0 | ||
| 161 | + self.leftLineView.isHidden = false | ||
| 162 | + self.rightLineView.isHidden = true | ||
| 163 | + | ||
| 146 | } else { | 164 | } else { |
| 147 | - leftButton.isSelected = false | 165 | + self.rightButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) |
| 148 | - rightButton.isSelected = true | 166 | + self.leftButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal) |
| 167 | + self.tabSelected = 1 | ||
| 168 | + self.leftLineView.isHidden = true | ||
| 169 | + self.rightLineView.isHidden = false | ||
| 149 | } | 170 | } |
| 150 | } | 171 | } |
| 151 | } | 172 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -183,7 +183,7 @@ import SwiftEventBus | ... | @@ -183,7 +183,7 @@ import SwiftEventBus |
| 183 | coupAttributedString.append(coupNormalString2) | 183 | coupAttributedString.append(coupNormalString2) |
| 184 | coupAttributedString.append(coupBoldString2) | 184 | coupAttributedString.append(coupBoldString2) |
| 185 | coupAttributedString.append(coupNormalString3) | 185 | coupAttributedString.append(coupNormalString3) |
| 186 | - couponEarnLabel.attributedText = attributedString | 186 | + couponEarnLabel.attributedText = coupAttributedString |
| 187 | 187 | ||
| 188 | couponEarnAmountLabel.text = totalCouponDiscountString + "€" | 188 | couponEarnAmountLabel.text = totalCouponDiscountString + "€" |
| 189 | 189 | ... | ... |
-
Please register or login to post a comment