From 55bb9d7beeae4b5b221e83d93278c7cf7d44cc03 Mon Sep 17 00:00:00 2001 From: Johan Degraeve Date: Fri, 20 Dec 2019 18:49:57 +0100 Subject: [PATCH] titles removed from UITabBarItem's --- xdrip.xcodeproj/project.pbxproj | 8 ++++++-- xdrip/Extensions/UITabBarController.swift | 14 ++++++++++++++ .../BluetoothPeripheralNavigationController.swift | 7 +++++++ .../Root View Controller/RootViewController.swift | 12 +++++++++++- .../SettingsNavigationController.swift | 8 ++++++++ 5 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 xdrip/Extensions/UITabBarController.swift diff --git a/xdrip.xcodeproj/project.pbxproj b/xdrip.xcodeproj/project.pbxproj index 2d3c24d3..af1b7e16 100644 --- a/xdrip.xcodeproj/project.pbxproj +++ b/xdrip.xcodeproj/project.pbxproj @@ -59,6 +59,7 @@ F8297F56238ED07700D74D66 /* BluetoothPeripheralManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8297F55238ED07700D74D66 /* BluetoothPeripheralManager.swift */; }; F8297F59238EE14E00D74D66 /* TextsBluetoothPeripheralsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8297F57238EE14E00D74D66 /* TextsBluetoothPeripheralsView.swift */; }; F8297F5A238EE14E00D74D66 /* TextsBluetoothPeripheralView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8297F58238EE14E00D74D66 /* TextsBluetoothPeripheralView.swift */; }; + F83098FE23AD3F84005741DF /* UITabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F83098FD23AD3F84005741DF /* UITabBarController.swift */; }; F856CE5B22EDC8E50083E436 /* ConstantsBluetoothPairing.swift in Sources */ = {isa = PBXBuildFile; fileRef = F856CE5A22EDC8E50083E436 /* ConstantsBluetoothPairing.swift */; }; F85DC2ED21CFE2F500B9F74A /* BgReading+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = F85DC2E721CFE2F500B9F74A /* BgReading+CoreDataProperties.swift */; }; F85DC2EF21CFE2F500B9F74A /* Sensor+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = F85DC2E921CFE2F500B9F74A /* Sensor+CoreDataProperties.swift */; }; @@ -306,6 +307,7 @@ F8297F55238ED07700D74D66 /* BluetoothPeripheralManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BluetoothPeripheralManager.swift; sourceTree = ""; }; F8297F57238EE14E00D74D66 /* TextsBluetoothPeripheralsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextsBluetoothPeripheralsView.swift; sourceTree = ""; }; F8297F58238EE14E00D74D66 /* TextsBluetoothPeripheralView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextsBluetoothPeripheralView.swift; sourceTree = ""; }; + F83098FD23AD3F84005741DF /* UITabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITabBarController.swift; sourceTree = ""; }; F846CDD523046BAC00DCF016 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/SettingsViews.strings"; sourceTree = ""; }; F846CDD623046BAE00DCF016 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/SettingsViews.strings; sourceTree = ""; }; F856CE5A22EDC8E50083E436 /* ConstantsBluetoothPairing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstantsBluetoothPairing.swift; sourceTree = ""; }; @@ -710,6 +712,7 @@ F8BDD4232218790E006EAB84 /* UserDefaults.swift */, F80859282364D61B00F3829D /* UserDefaults+charts.swift */, F808592C23677D6A00F3829D /* ChartPoint.swift */, + F83098FD23AD3F84005741DF /* UITabBarController.swift */, ); path = Extensions; sourceTree = ""; @@ -1755,6 +1758,7 @@ F81FA006228E09D40028C70F /* TextsCalibration.swift in Sources */, F8F9721923A5915900C3F17D /* CGMGNSEntryTransmitter.swift in Sources */, F8B3A84A227F090E004BA588 /* SettingsViewGeneralSettingsViewModel.swift in Sources */, + F83098FE23AD3F84005741DF /* UITabBarController.swift in Sources */, F8B3A85B2280CCD1004BA588 /* AlertSettingsViewController.swift in Sources */, F8F9722E23A5915900C3F17D /* M5StackTransmitterOpCode.swift in Sources */, F8F9720223A5915900C3F17D /* CGMG6Transmitter.swift in Sources */, @@ -2366,7 +2370,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 3.4.0; - PRODUCT_BUNDLE_IDENTIFIER = net.johandegraeve.xdripswift; + PRODUCT_BUNDLE_IDENTIFIER = net.johandegraeve.iosxdripreader; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "xdrip/xdrip-Bridging-Header.h"; @@ -2394,7 +2398,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 3.4.0; - PRODUCT_BUNDLE_IDENTIFIER = net.johandegraeve.xdripswift; + PRODUCT_BUNDLE_IDENTIFIER = net.johandegraeve.iosxdripreader; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "xdrip/xdrip-Bridging-Header.h"; diff --git a/xdrip/Extensions/UITabBarController.swift b/xdrip/Extensions/UITabBarController.swift new file mode 100644 index 00000000..8c60745d --- /dev/null +++ b/xdrip/Extensions/UITabBarController.swift @@ -0,0 +1,14 @@ +import Foundation +import UIKit + +extension UITabBarController { + func cleanTitles() { + guard let items = self.tabBar.items else { + return + } + for item in items { + item.title = "" + item.imageInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) + } + } +} diff --git a/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralNavigationController.swift b/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralNavigationController.swift index 34ef9818..7d2b6351 100644 --- a/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralNavigationController.swift +++ b/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralNavigationController.swift @@ -29,6 +29,13 @@ final class BluetoothPeripheralNavigationController: UINavigationController { delegate = self } + override func viewDidAppear(_ animated: Bool) { + + // remove titles from tabbar items + self.tabBarController?.cleanTitles() + + } + } extension BluetoothPeripheralNavigationController: UINavigationControllerDelegate { diff --git a/xdrip/View Controllers/Root View Controller/RootViewController.swift b/xdrip/View Controllers/Root View Controller/RootViewController.swift index fe238dd6..3df0dde4 100644 --- a/xdrip/View Controllers/Root View Controller/RootViewController.swift +++ b/xdrip/View Controllers/Root View Controller/RootViewController.swift @@ -221,6 +221,13 @@ final class RootViewController: UIViewController { } + override func viewDidAppear(_ animated: Bool) { + + // remove titles from tabbar items + self.tabBarController?.cleanTitles() + + } + override func viewDidLoad() { super.viewDidLoad() @@ -577,6 +584,9 @@ final class RootViewController: UIViewController { /// Configure View, only stuff that is independent of coredata private func setupView() { + // remove titles from tabbar items + self.tabBarController?.cleanTitles() + // set texts for buttons on top calibrateButtonOutlet.setTitle(Texts_HomeView.calibrationButton, for: .normal) preSnoozeButtonOutlet.setTitle(Texts_HomeView.snoozeButton, for: .normal) @@ -1559,7 +1569,7 @@ extension RootViewController: UITabBarControllerDelegate { } else if let navigationController = viewController as? BluetoothPeripheralNavigationController, let bluetoothPeripheralManager = bluetoothPeripheralManager, let coreDataManager = coreDataManager { navigationController.configure(coreDataManager: coreDataManager, bluetoothPeripheralManager: bluetoothPeripheralManager) - + } } diff --git a/xdrip/View Controllers/SettingsNavigationController/SettingsNavigationController.swift b/xdrip/View Controllers/SettingsNavigationController/SettingsNavigationController.swift index be20b454..21f2f53d 100644 --- a/xdrip/View Controllers/SettingsNavigationController/SettingsNavigationController.swift +++ b/xdrip/View Controllers/SettingsNavigationController/SettingsNavigationController.swift @@ -29,6 +29,14 @@ final class SettingsNavigationController: UINavigationController { delegate = self } + override func viewDidAppear(_ animated: Bool) { + + // remove titles from tabbar items + self.tabBarController?.cleanTitles() + + } + + } extension SettingsNavigationController:UINavigationControllerDelegate {