Open CharlieOxendine opened 3 years ago
I got the same problem
Looks to me that draw is not called when buttons are initially disabled. One workaround would be to remove the body of the draw function from the CloseButton() completely and instead use something similar to:
self.removeButton.setImage(UIImage(systemName: "trash"), for: .normal)
to draw a trash icon.
You can add that line in the TagView class inside of a public init(title: String)
function.
Here is how my public init(title: String)
looks:
public init(title: String) { super.init(frame: CGRect.zero) setTitle(title, for: UIControl.State()) setupView() self.removeButton.setImage(UIImage(systemName: "trash"), for: .normal) }
If you try and use a button to trigger enabling the remove button it will show the extra space for a remove icon, but the icon will be invisible. A work around for this is by calling
interestsTagView.enableRemoveButton = true
in the ViewDidLoad and then, in ViewDidAppear, call
interestsTagView.enableRemoveButton = false