refactored tooltip to use icon
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
d5489dc9af
commit
e186b77763
@ -38,10 +38,10 @@ open class Tooltip: Control, TooltipLaunchable {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
open var imageView = UIImageView().with {
|
||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||
$0.contentMode = .scaleAspectFill
|
||||
$0.clipsToBounds = true
|
||||
open var icon = Icon().with {
|
||||
$0.name = .info
|
||||
$0.size = .small
|
||||
$0.isUserInteractionEnabled = false
|
||||
}
|
||||
|
||||
open var closeButtonText: String = "Close" { didSet { setNeedsUpdate() }}
|
||||
@ -111,18 +111,8 @@ open class Tooltip: Control, TooltipLaunchable {
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
if let image = BundleManager.shared.image(for: "info") {
|
||||
infoImage = image
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
addSubview(icon)
|
||||
icon.pinToSuperView()
|
||||
backgroundColor = .clear
|
||||
|
||||
isAccessibilityElement = true
|
||||
@ -149,7 +139,6 @@ open class Tooltip: Control, TooltipLaunchable {
|
||||
content = ""
|
||||
fillColor = .primary
|
||||
closeButtonText = "Close"
|
||||
imageView.image = nil
|
||||
shouldUpdateView = true
|
||||
setNeedsUpdate()
|
||||
}
|
||||
@ -158,14 +147,11 @@ open class Tooltip: Control, TooltipLaunchable {
|
||||
open override func updateView() {
|
||||
super.updateView()
|
||||
|
||||
//set the dimensions
|
||||
let dimensions = size.value.dimensions
|
||||
heightConstraint?.constant = dimensions.height
|
||||
widthConstraint?.constant = dimensions.width
|
||||
//get the size
|
||||
icon.size = size.value
|
||||
|
||||
//get the color for the image
|
||||
let imageColor = iconColorConfiguration.getColor(self)
|
||||
imageView.image = infoImage.withTintColor(imageColor)
|
||||
icon.color = iconColorConfiguration.getColor(self)
|
||||
}
|
||||
|
||||
open override func updateAccessibility() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user