Showing
6 changed files
with
168 additions
and
0 deletions
| ... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
| 19 | 1E15B9A229DDCF02000A408D /* MarketSharingHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E15B9A129DDCF02000A408D /* MarketSharingHistoryViewController.swift */; }; | 19 | 1E15B9A229DDCF02000A408D /* MarketSharingHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E15B9A129DDCF02000A408D /* MarketSharingHistoryViewController.swift */; }; |
| 20 | 1E15B9A429DDD211000A408D /* MarketHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */; }; | 20 | 1E15B9A429DDD211000A408D /* MarketHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */; }; |
| 21 | 1E2966EA2837A21D00F83FAC /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1E2966E92837A21D00F83FAC /* RSBarcodes_Swift */; }; | 21 | 1E2966EA2837A21D00F83FAC /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1E2966E92837A21D00F83FAC /* RSBarcodes_Swift */; }; |
| 22 | + 1E36E43D2CBFDD5100A60198 /* PopupInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E36E43C2CBFDD5100A60198 /* PopupInfoViewController.swift */; }; | ||
| 22 | 1E4195FB2AE691D20094DADE /* WalletActiveCouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E4195FA2AE691D20094DADE /* WalletActiveCouponsTableViewCell.swift */; }; | 23 | 1E4195FB2AE691D20094DADE /* WalletActiveCouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E4195FA2AE691D20094DADE /* WalletActiveCouponsTableViewCell.swift */; }; |
| 23 | 1E4410B128F5855000859F92 /* CampaignCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E4410B028F5855000859F92 /* CampaignCategory.swift */; }; | 24 | 1E4410B128F5855000859F92 /* CampaignCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E4410B028F5855000859F92 /* CampaignCategory.swift */; }; |
| 24 | 1E46B4BF2BEBB68800D5B488 /* WalletActiveCouponsScrollTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E46B4BE2BEBB68800D5B488 /* WalletActiveCouponsScrollTableViewCell.swift */; }; | 25 | 1E46B4BF2BEBB68800D5B488 /* WalletActiveCouponsScrollTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E46B4BE2BEBB68800D5B488 /* WalletActiveCouponsScrollTableViewCell.swift */; }; |
| ... | @@ -212,6 +213,7 @@ | ... | @@ -212,6 +213,7 @@ |
| 212 | 1E151F1929DAE4D500951FA0 /* ActiveCodeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActiveCodeTableViewCell.swift; sourceTree = "<group>"; }; | 213 | 1E151F1929DAE4D500951FA0 /* ActiveCodeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActiveCodeTableViewCell.swift; sourceTree = "<group>"; }; |
| 213 | 1E15B9A129DDCF02000A408D /* MarketSharingHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketSharingHistoryViewController.swift; sourceTree = "<group>"; }; | 214 | 1E15B9A129DDCF02000A408D /* MarketSharingHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketSharingHistoryViewController.swift; sourceTree = "<group>"; }; |
| 214 | 1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketHistoryViewController.swift; sourceTree = "<group>"; }; | 215 | 1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketHistoryViewController.swift; sourceTree = "<group>"; }; |
| 216 | + 1E36E43C2CBFDD5100A60198 /* PopupInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupInfoViewController.swift; sourceTree = "<group>"; }; | ||
| 215 | 1E4195FA2AE691D20094DADE /* WalletActiveCouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletActiveCouponsTableViewCell.swift; sourceTree = "<group>"; }; | 217 | 1E4195FA2AE691D20094DADE /* WalletActiveCouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletActiveCouponsTableViewCell.swift; sourceTree = "<group>"; }; |
| 216 | 1E4410B028F5855000859F92 /* CampaignCategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignCategory.swift; sourceTree = "<group>"; }; | 218 | 1E4410B028F5855000859F92 /* CampaignCategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignCategory.swift; sourceTree = "<group>"; }; |
| 217 | 1E46B4BE2BEBB68800D5B488 /* WalletActiveCouponsScrollTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletActiveCouponsScrollTableViewCell.swift; sourceTree = "<group>"; }; | 219 | 1E46B4BE2BEBB68800D5B488 /* WalletActiveCouponsScrollTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletActiveCouponsScrollTableViewCell.swift; sourceTree = "<group>"; }; |
| ... | @@ -564,6 +566,7 @@ | ... | @@ -564,6 +566,7 @@ |
| 564 | 1EB236AC28816C560063777A /* NumberPopupViewController.swift */, | 566 | 1EB236AC28816C560063777A /* NumberPopupViewController.swift */, |
| 565 | 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */, | 567 | 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */, |
| 566 | 1EB5F4C728536FD60016F36E /* StepsViewController.swift */, | 568 | 1EB5F4C728536FD60016F36E /* StepsViewController.swift */, |
| 569 | + 1E36E43C2CBFDD5100A60198 /* PopupInfoViewController.swift */, | ||
| 567 | E6A77860282933E40045BBA8 /* MyApi.h */, | 570 | E6A77860282933E40045BBA8 /* MyApi.h */, |
| 568 | E6A778DC282933E60045BBA8 /* MyApi.m */, | 571 | E6A778DC282933E60045BBA8 /* MyApi.m */, |
| 569 | E6A77862282933E50045BBA8 /* MyEmptyClass.swift */, | 572 | E6A77862282933E50045BBA8 /* MyEmptyClass.swift */, |
| ... | @@ -1070,6 +1073,7 @@ | ... | @@ -1070,6 +1073,7 @@ |
| 1070 | 1E15B9A229DDCF02000A408D /* MarketSharingHistoryViewController.swift in Sources */, | 1073 | 1E15B9A229DDCF02000A408D /* MarketSharingHistoryViewController.swift in Sources */, |
| 1071 | A079366E2885D07700064122 /* AnalysisChildViewController.swift in Sources */, | 1074 | A079366E2885D07700064122 /* AnalysisChildViewController.swift in Sources */, |
| 1072 | E6A77950282933E70045BBA8 /* FMResultSet.m in Sources */, | 1075 | E6A77950282933E70045BBA8 /* FMResultSet.m in Sources */, |
| 1076 | + 1E36E43D2CBFDD5100A60198 /* PopupInfoViewController.swift in Sources */, | ||
| 1073 | 1E151F1A29DAE4D500951FA0 /* ActiveCodeTableViewCell.swift in Sources */, | 1077 | 1E151F1A29DAE4D500951FA0 /* ActiveCodeTableViewCell.swift in Sources */, |
| 1074 | E6A77936282933E70045BBA8 /* AFAutoPurgingImageCache.m in Sources */, | 1078 | E6A77936282933E70045BBA8 /* AFAutoPurgingImageCache.m in Sources */, |
| 1075 | A079367E2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift in Sources */, | 1079 | A079367E2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift in Sources */, | ... | ... |
No preview for this file type
This diff is collapsed. Click to expand it.
| 1 | +// | ||
| 2 | +// PopupInfoViewController.swift | ||
| 3 | +// SwiftWarplyFramework | ||
| 4 | +// | ||
| 5 | +// Created by Manos Chorianopoulos on 16/10/24. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import UIKit | ||
| 9 | + | ||
| 10 | +class PopupInfoViewController: UIViewController { | ||
| 11 | + @IBOutlet weak var popupView: UIView! | ||
| 12 | + @IBOutlet weak var headerLabel: UILabel! | ||
| 13 | + @IBOutlet weak var headerCloseButton: UIButton! | ||
| 14 | + @IBOutlet weak var infoLabel: UILabel! | ||
| 15 | + @IBOutlet weak var submitButton: UIButton! | ||
| 16 | + | ||
| 17 | + override func viewDidLoad() { | ||
| 18 | + super.viewDidLoad() | ||
| 19 | + | ||
| 20 | + // Add arrow programmatically | ||
| 21 | + let arrowSize = CGSize(width: 30, height: 15) // Width and height of the arrow | ||
| 22 | + let arrowView = ArrowView(frame: CGRect(x: (self.view.frame.width - arrowSize.width) / 2, | ||
| 23 | + y: popupView.frame.minY - arrowSize.height, | ||
| 24 | + width: arrowSize.width, | ||
| 25 | + height: arrowSize.height)) | ||
| 26 | + | ||
| 27 | + self.view.addSubview(arrowView) | ||
| 28 | + self.view.bringSubviewToFront(popupView) | ||
| 29 | + | ||
| 30 | + popupView.backgroundColor = UIColor(rgb: 0xE6E6E6) | ||
| 31 | + popupView.layer.cornerRadius = 14 | ||
| 32 | + // Add shadow | ||
| 33 | + popupView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.57).cgColor | ||
| 34 | + popupView.layer.shadowOffset = CGSize(width: 0.0, height: 3.0) | ||
| 35 | + popupView.layer.shadowOpacity = 1.0 | ||
| 36 | + popupView.layer.shadowRadius = 20.0 | ||
| 37 | + | ||
| 38 | + headerLabel.font = UIFont(name: "BTCosmo-Bold", size: 17) | ||
| 39 | + headerLabel.textColor = UIColor(rgb: 0x212121) | ||
| 40 | + headerLabel.text = "SUPERMARKET DEALS" | ||
| 41 | + | ||
| 42 | + headerCloseButton.setImage(UIImage(named: "ic_close_3.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) | ||
| 43 | + headerCloseButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5) | ||
| 44 | + | ||
| 45 | + infoLabel.font = UIFont(name: "PeridotPE-Regular", size: 16.0) | ||
| 46 | + infoLabel.textColor = UIColor(rgb: 0x212121) | ||
| 47 | + infoLabel.text = "Δημιούργησε το δικό σου ενιαίο κουπόνι προσφορών, και εξαργύρωσέ το στα supermarket της επιλογής σου γρήγορα και εύκολα με ένα μόνο κωδικό κουπονιού!" | ||
| 48 | + | ||
| 49 | + submitButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 14) | ||
| 50 | + submitButton.setTitle("Τέλος", for: .normal) | ||
| 51 | + submitButton.setTitleColor(UIColor(rgb: 0x212121), for: .normal) | ||
| 52 | + submitButton.frame.size.width = submitButton.intrinsicContentSize.width | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle { | ||
| 56 | + return UIModalPresentationStyle.none | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle { | ||
| 60 | + // return UIModalPresentationStyle.FullScreen | ||
| 61 | + return UIModalPresentationStyle.none | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + // MARK: - Actions | ||
| 65 | + @IBAction func headerCloseButtonAction(_ sender: Any) { | ||
| 66 | + self.dismiss(animated: true, completion: {}) | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @IBAction func submitButtonAction(_ sender: Any) { | ||
| 70 | + self.dismiss(animated: true, completion: {}) | ||
| 71 | + } | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +class ArrowView: UIView { | ||
| 75 | + | ||
| 76 | + override init(frame: CGRect) { | ||
| 77 | + super.init(frame: frame) | ||
| 78 | + self.backgroundColor = .clear | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + required init?(coder: NSCoder) { | ||
| 82 | + super.init(coder: coder) | ||
| 83 | + self.backgroundColor = .clear | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + override func draw(_ rect: CGRect) { | ||
| 87 | + // Set up the context | ||
| 88 | + guard let context = UIGraphicsGetCurrentContext() else { return } | ||
| 89 | + | ||
| 90 | + // Set the arrow color (can adjust as needed) | ||
| 91 | + context.setFillColor(UIColor(rgb: 0xE6E6E6).cgColor) | ||
| 92 | + | ||
| 93 | + // Create the arrow's path (a triangle) | ||
| 94 | + let path = UIBezierPath() | ||
| 95 | + path.move(to: CGPoint(x: rect.width / 2, y: 0)) // Arrow top | ||
| 96 | + path.addLine(to: CGPoint(x: rect.width, y: rect.height)) // Bottom right | ||
| 97 | + path.addLine(to: CGPoint(x: 0, y: rect.height)) // Bottom left | ||
| 98 | + path.close() // Close the triangle | ||
| 99 | + | ||
| 100 | + // Fill the arrow shape | ||
| 101 | + context.addPath(path.cgPath) | ||
| 102 | + context.fillPath() | ||
| 103 | + } | ||
| 104 | +} |
| ... | @@ -71,6 +71,11 @@ import SwiftEventBus | ... | @@ -71,6 +71,11 @@ import SwiftEventBus |
| 71 | 71 | ||
| 72 | setBackButton() | 72 | setBackButton() |
| 73 | setNavigationTitle("SUPERMARKET DEALS") | 73 | setNavigationTitle("SUPERMARKET DEALS") |
| 74 | + // Setup the info button with an action | ||
| 75 | + setNavBarRightInfoButton() { | ||
| 76 | + // This closure is the action that will be executed when the info button is tapped | ||
| 77 | + self.presentInfoPopup() | ||
| 78 | + } | ||
| 74 | 79 | ||
| 75 | // backgroundImage.image = UIImage(named: "coupons_scrollview_dark", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 80 | // backgroundImage.image = UIImage(named: "coupons_scrollview_dark", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 76 | 81 | ||
| ... | @@ -175,6 +180,14 @@ import SwiftEventBus | ... | @@ -175,6 +180,14 @@ import SwiftEventBus |
| 175 | handleSubmitButtonUI() | 180 | handleSubmitButtonUI() |
| 176 | } | 181 | } |
| 177 | 182 | ||
| 183 | + private func presentInfoPopup() { | ||
| 184 | + let storyboard = UIStoryboard(name: "Main", bundle: nil) | ||
| 185 | + if let popupVC = storyboard.instantiateViewController(withIdentifier: "PopupInfoViewController") as? PopupInfoViewController { | ||
| 186 | + popupVC.modalPresentationStyle = .overCurrentContext | ||
| 187 | + popupVC.modalTransitionStyle = .crossDissolve | ||
| 188 | + self.present(popupVC, animated: true, completion: nil) | ||
| 189 | + } | ||
| 190 | + } | ||
| 178 | 191 | ||
| 179 | func handleSubmitButtonUI() { | 192 | func handleSubmitButtonUI() { |
| 180 | if (self.smCouponsSelected.count > 0) { | 193 | if (self.smCouponsSelected.count > 0) { | ... | ... |
| ... | @@ -93,6 +93,53 @@ extension UIViewController { | ... | @@ -93,6 +93,53 @@ extension UIViewController { |
| 93 | // self.dismiss(animated: true, completion: {}) | 93 | // self.dismiss(animated: true, completion: {}) |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | + // Define a typealias for the action closure | ||
| 97 | + typealias InfoButtonAction = () -> Void | ||
| 98 | + | ||
| 99 | + // Store the action closure | ||
| 100 | + private struct AssociatedKeys { | ||
| 101 | + static var infoButtonAction = "infoButtonAction" | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + var infoButtonAction: InfoButtonAction? { | ||
| 105 | + get { | ||
| 106 | + return objc_getAssociatedObject(self, &AssociatedKeys.infoButtonAction) as? InfoButtonAction | ||
| 107 | + } | ||
| 108 | + set { | ||
| 109 | + objc_setAssociatedObject(self, &AssociatedKeys.infoButtonAction, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + func setNavBarRightInfoButton(action: @escaping InfoButtonAction) { | ||
| 114 | + // Create a UIView for the custom info button | ||
| 115 | + let customInfoView = UIView(frame: CGRect(x: 0, y: 0, width: 24, height: 24)) | ||
| 116 | + | ||
| 117 | + // Create the UIImageView for the custom info image | ||
| 118 | + let infoImageView = UIImageView(image: UIImage(named: "info_icon", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)) // Your custom image | ||
| 119 | + infoImageView.contentMode = .scaleAspectFit // Adjust to fit the image correctly | ||
| 120 | + infoImageView.frame = customInfoView.bounds // Set the image to fill the view | ||
| 121 | + | ||
| 122 | + // Add the image view to the custom view | ||
| 123 | + customInfoView.addSubview(infoImageView) | ||
| 124 | + | ||
| 125 | + // Set the action closure | ||
| 126 | + self.infoButtonAction = action | ||
| 127 | + | ||
| 128 | + // Add a tap gesture recognizer to handle the tap on the custom view | ||
| 129 | + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(infoButtonTapped)) | ||
| 130 | + customInfoView.addGestureRecognizer(tapGesture) | ||
| 131 | + | ||
| 132 | + // Add the custom view to the navigation bar as a UIBarButtonItem | ||
| 133 | + let infoBarButtonItem = UIBarButtonItem(customView: customInfoView) | ||
| 134 | + self.navigationItem.rightBarButtonItem = infoBarButtonItem | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + // Action for the info button tap | ||
| 138 | + @objc private func infoButtonTapped() { | ||
| 139 | + // Call the action closure if it's set | ||
| 140 | + infoButtonAction?() | ||
| 141 | + } | ||
| 142 | + | ||
| 96 | func addNavShadow() { | 143 | func addNavShadow() { |
| 97 | // Add shadow | 144 | // Add shadow |
| 98 | self.navigationController?.navigationBar.layer.masksToBounds = false | 145 | self.navigationController?.navigationBar.layer.masksToBounds = false | ... | ... |
-
Please register or login to post a comment