refactored tooltip to use icon
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
d5489dc9af
commit
e186b77763
@ -200,7 +200,7 @@ open class Tabs: View {
|
|||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Function used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
updateStackView()
|
updateStackView()
|
||||||
updateTabs()
|
updateTabs()
|
||||||
updateContentView()
|
updateContentView()
|
||||||
|
|||||||
@ -38,10 +38,10 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open var imageView = UIImageView().with {
|
open var icon = Icon().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.name = .info
|
||||||
$0.contentMode = .scaleAspectFill
|
$0.size = .small
|
||||||
$0.clipsToBounds = true
|
$0.isUserInteractionEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
open var closeButtonText: String = "Close" { didSet { setNeedsUpdate() }}
|
open var closeButtonText: String = "Close" { didSet { setNeedsUpdate() }}
|
||||||
@ -111,18 +111,8 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
if let image = BundleManager.shared.image(for: "info") {
|
addSubview(icon)
|
||||||
infoImage = image
|
icon.pinToSuperView()
|
||||||
}
|
|
||||||
|
|
||||||
addSubview(imageView)
|
|
||||||
|
|
||||||
imageView.pinToSuperView()
|
|
||||||
heightConstraint = imageView.heightAnchor.constraint(equalToConstant: size.value.dimensions.height)
|
|
||||||
heightConstraint?.isActive = true
|
|
||||||
widthConstraint = imageView.widthAnchor.constraint(equalToConstant: size.value.dimensions.width)
|
|
||||||
widthConstraint?.isActive = true
|
|
||||||
|
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
@ -149,7 +139,6 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
content = ""
|
content = ""
|
||||||
fillColor = .primary
|
fillColor = .primary
|
||||||
closeButtonText = "Close"
|
closeButtonText = "Close"
|
||||||
imageView.image = nil
|
|
||||||
shouldUpdateView = true
|
shouldUpdateView = true
|
||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
@ -157,15 +146,12 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
/// Function used to make changes to the View based off a change events or from local properties.
|
/// Function used to make changes to the View based off a change events or from local properties.
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
//set the dimensions
|
//get the size
|
||||||
let dimensions = size.value.dimensions
|
icon.size = size.value
|
||||||
heightConstraint?.constant = dimensions.height
|
|
||||||
widthConstraint?.constant = dimensions.width
|
|
||||||
|
|
||||||
//get the color for the image
|
//get the color for the image
|
||||||
let imageColor = iconColorConfiguration.getColor(self)
|
icon.color = iconColorConfiguration.getColor(self)
|
||||||
imageView.image = infoImage.withTintColor(imageColor)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateAccessibility() {
|
open override func updateAccessibility() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user