Showing
3 changed files
with
55 additions
and
0 deletions
... | @@ -7,6 +7,7 @@ | ... | @@ -7,6 +7,7 @@ |
7 | objects = { | 7 | objects = { |
8 | 8 | ||
9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
10 | + 1E7564BA2823C6D900B9D2AE /* ViewControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7564B92823C6D900B9D2AE /* ViewControllerExtensions.swift */; }; | ||
10 | 1EBB036F281BE3610062F663 /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBB036E281BE3610062F663 /* RSBarcodes_Swift */; }; | 11 | 1EBB036F281BE3610062F663 /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBB036E281BE3610062F663 /* RSBarcodes_Swift */; }; |
11 | 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; }; | 12 | 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; }; |
12 | E634A369282299770069DE27 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E634A368282299760069DE27 /* Main.storyboard */; }; | 13 | E634A369282299770069DE27 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E634A368282299760069DE27 /* Main.storyboard */; }; |
... | @@ -132,6 +133,7 @@ | ... | @@ -132,6 +133,7 @@ |
132 | 133 | ||
133 | /* Begin PBXFileReference section */ | 134 | /* Begin PBXFileReference section */ |
134 | 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | 135 | 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
136 | + 1E7564B92823C6D900B9D2AE /* ViewControllerExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControllerExtensions.swift; sourceTree = "<group>"; }; | ||
135 | B9413513157AD76ECE896B81 /* Pods-WarplySDKFrameworkIOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WarplySDKFrameworkIOS.release.xcconfig"; path = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS.release.xcconfig"; sourceTree = "<group>"; }; | 137 | B9413513157AD76ECE896B81 /* Pods-WarplySDKFrameworkIOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WarplySDKFrameworkIOS.release.xcconfig"; path = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS.release.xcconfig"; sourceTree = "<group>"; }; |
136 | E634A368282299760069DE27 /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; }; | 138 | E634A368282299760069DE27 /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; }; |
137 | E634A36A2822999B0069DE27 /* CouponsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsViewController.swift; sourceTree = "<group>"; }; | 139 | E634A36A2822999B0069DE27 /* CouponsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsViewController.swift; sourceTree = "<group>"; }; |
... | @@ -328,6 +330,7 @@ | ... | @@ -328,6 +330,7 @@ |
328 | E67D1EC528117F2400940F01 /* swiftApi.swift */, | 330 | E67D1EC528117F2400940F01 /* swiftApi.swift */, |
329 | E634A368282299760069DE27 /* Main.storyboard */, | 331 | E634A368282299760069DE27 /* Main.storyboard */, |
330 | E634A36A2822999B0069DE27 /* CouponsViewController.swift */, | 332 | E634A36A2822999B0069DE27 /* CouponsViewController.swift */, |
333 | + 1E7564B92823C6D900B9D2AE /* ViewControllerExtensions.swift */, | ||
331 | ); | 334 | ); |
332 | path = WarplySDKFrameworkIOS; | 335 | path = WarplySDKFrameworkIOS; |
333 | sourceTree = "<group>"; | 336 | sourceTree = "<group>"; |
... | @@ -732,6 +735,7 @@ | ... | @@ -732,6 +735,7 @@ |
732 | E6D8DF2927A942920006A3A9 /* NSData+SSToolkitAdditions.m in Sources */, | 735 | E6D8DF2927A942920006A3A9 /* NSData+SSToolkitAdditions.m in Sources */, |
733 | E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */, | 736 | E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */, |
734 | E6D8DF4A27A942920006A3A9 /* AFNetworkReachabilityManager.m in Sources */, | 737 | E6D8DF4A27A942920006A3A9 /* AFNetworkReachabilityManager.m in Sources */, |
738 | + 1E7564BA2823C6D900B9D2AE /* ViewControllerExtensions.swift in Sources */, | ||
735 | E6D8DF4B27A942920006A3A9 /* AFSecurityPolicy.m in Sources */, | 739 | E6D8DF4B27A942920006A3A9 /* AFSecurityPolicy.m in Sources */, |
736 | E6D8DF1327A942920006A3A9 /* WLBeaconManager.m in Sources */, | 740 | E6D8DF1327A942920006A3A9 /* WLBeaconManager.m in Sources */, |
737 | E6D8DF0427A942920006A3A9 /* WLInboxItem.m in Sources */, | 741 | E6D8DF0427A942920006A3A9 /* WLInboxItem.m in Sources */, | ... | ... |
No preview for this file type
1 | +// | ||
2 | +// ViewControllerExtensions.swift | ||
3 | +// WarplySDKFrameworkIOS | ||
4 | +// | ||
5 | +// Created by Manos Chorianopoulos on 5/5/22. | ||
6 | +// | ||
7 | + | ||
8 | +import UIKit | ||
9 | + | ||
10 | +extension UIViewController { | ||
11 | + func setBackButton() { | ||
12 | + let uiscreen: CGRect = UIScreen.main.bounds | ||
13 | + | ||
14 | + let backButton = UIButton(type: UIButton.ButtonType.custom) as UIButton | ||
15 | + backButton.frame = CGRect(x: 0, y: 0, width: uiscreen.height * 0.025, height: uiscreen.height * 0.02) | ||
16 | + backButton.imageView!.contentMode = .scaleAspectFit | ||
17 | + //backButton.setBackgroundImage(UIImage(named:Assets.Navigation.backButton), for: UIControlState()) | ||
18 | + backButton.setImage(UIImage(named: "ic_back"), for: .normal) | ||
19 | +// backButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: -20, bottom: 0, right: 0) | ||
20 | + backButton.addTarget(self, action: #selector(moveToBack(_:)), for: .touchUpInside) | ||
21 | + | ||
22 | + | ||
23 | + backButton.translatesAutoresizingMaskIntoConstraints = false | ||
24 | + // Add width, height constraints | ||
25 | + 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) | ||
26 | + 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) | ||
27 | + NSLayoutConstraint.activate([heightContraints,widthContraints]) | ||
28 | + | ||
29 | + let leftBarButtonItem: UIBarButtonItem = UIBarButtonItem(customView: backButton) | ||
30 | + self.navigationItem.setLeftBarButton(leftBarButtonItem, animated: false) | ||
31 | + self.navigationItem.title = "" | ||
32 | + } | ||
33 | + | ||
34 | + | ||
35 | + @objc func moveToBack(_ sender:UIButton){ | ||
36 | + self.navigationController?.popViewController(animated: true) | ||
37 | + } | ||
38 | + | ||
39 | + func setNavigationTitle(_ title: String) { | ||
40 | + let uiscreen: CGRect = UIScreen.main.bounds | ||
41 | + | ||
42 | + let titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: uiscreen.width * 0.7, height: uiscreen.height * 0.03)) | ||
43 | + titleLabel.text = title | ||
44 | + titleLabel.textColor = UIColor(red: 0.21, green: 0.32, blue: 0.41, alpha: 1.00) | ||
45 | + titleLabel.font = UIFont.systemFont(ofSize: 16, weight: UIFont.Weight.medium) | ||
46 | + titleLabel.adjustsFontSizeToFitWidth = true | ||
47 | + titleLabel.textAlignment = .center | ||
48 | + self.navigationItem.titleView = titleLabel | ||
49 | + | ||
50 | + } | ||
51 | +} |
-
Please register or login to post a comment