From 897d726ee9506af1430a465ec81eb6688b0bfeca Mon Sep 17 00:00:00 2001 From: Andrea Busi Date: Mon, 8 Mar 2021 21:20:38 +0100 Subject: [PATCH] refactor: Use blurred button in simulator map --- .../Controllers/Alerts/AllerteViewController.m | 3 +-- .../Simulator/AlertSimulatorViewController.swift | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Sources/Earthquake Network/Controllers/Alerts/AllerteViewController.m b/Sources/Earthquake Network/Controllers/Alerts/AllerteViewController.m index d8c6eab..b4a51c1 100644 --- a/Sources/Earthquake Network/Controllers/Alerts/AllerteViewController.m +++ b/Sources/Earthquake Network/Controllers/Alerts/AllerteViewController.m @@ -196,8 +196,7 @@ typedef NS_ENUM(NSInteger, AllerteTableRow) { - (void)actionOpenSimulator { AlertSimulatorViewController *controller = [[AlertSimulatorViewController alloc] init]; - UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller]; - [self presentViewController:navController animated:YES completion:nil]; + [self presentViewController:controller animated:YES completion:nil]; } - (void)actionHowItWorks diff --git a/Sources/Earthquake Network/Controllers/Simulator/AlertSimulatorViewController.swift b/Sources/Earthquake Network/Controllers/Simulator/AlertSimulatorViewController.swift index 1624fd4..ff40faf 100644 --- a/Sources/Earthquake Network/Controllers/Simulator/AlertSimulatorViewController.swift +++ b/Sources/Earthquake Network/Controllers/Simulator/AlertSimulatorViewController.swift @@ -52,6 +52,14 @@ class AlertSimulatorViewController: UIViewController, MKMapViewDelegate { return view }() + private lazy var closeButton: EQNBlurredCloseButton = { + let button = EQNBlurredCloseButton() + button.translatesAutoresizingMaskIntoConstraints = false + button.addTarget(self, action: #selector(closeTapped(_:)), for: .touchUpInside) + button.setTitleColor(.darkGray, for: .normal) + return button + }() + private lazy var mapView: MKMapView = { let map = MKMapView() map.translatesAutoresizingMaskIntoConstraints = false @@ -95,6 +103,7 @@ class AlertSimulatorViewController: UIViewController, MKMapViewDelegate { private func setupUI() { view.addSubview(mapView) + view.addSubview(closeButton) view.addSubview(viewfinderView) view.addSubview(calculateButton) @@ -103,6 +112,8 @@ class AlertSimulatorViewController: UIViewController, MKMapViewDelegate { mapView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true mapView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true + closeButton.addDefaultConstraint(to: view) + viewfinderView.topAnchor.constraint(equalTo: mapView.topAnchor).isActive = true viewfinderView.bottomAnchor.constraint(equalTo: mapView.bottomAnchor).isActive = true viewfinderView.leftAnchor.constraint(equalTo: mapView.leftAnchor).isActive = true