From 27b9dadd1120ca455698e0d96938e7dc38189510 Mon Sep 17 00:00:00 2001 From: Libasse MBAYE Date: Wed, 7 Dec 2022 12:19:41 +0100 Subject: [PATCH] Update MASegmentedControl.swift --- .../Class/MASegmentedControl.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/MASegmentedControl/Class/MASegmentedControl.swift b/MASegmentedControl/Class/MASegmentedControl.swift index 18e0ebf..6536ca4 100755 --- a/MASegmentedControl/Class/MASegmentedControl.swift +++ b/MASegmentedControl/Class/MASegmentedControl.swift @@ -283,6 +283,26 @@ public class MASegmentedControl: UIControl { thumbView.frame = CGRect(x: thumbViewPositionX, y: thumbViewPositionY, width: thumbViewWidth, height: thumbViewHeight) thumbView.layer.cornerRadius = roundedControl ? thumbViewHeight / 2 : 1.0 thumbView.backgroundColor = thumbViewColor + + // To have thumbView on the active bouton when app is in background + for (btnIndex, btn) in self.buttons.enumerated() { + + btn.setTitleColor(textColor, for: .normal) + if !itemsWithDynamicColor { + if !buttonsWithDynamicImages { + btn.tintColor = buttonColorForNormal + } + } + if btnIndex == selectedSegmentIndex { + fillEqually ? moveThumbView(at: btnIndex) : moveThumbViewFillEquallyFalse(at: btnIndex) + btn.setTitleColor(selectedTextColor, for: .normal) + if !itemsWithDynamicColor { + if !buttonsWithDynamicImages { + btn.tintColor = buttonColorForSelected + } + } + } + } } //4 MARK: BUTTONS LAYOUTS