SwiftでTooltipを書く
SwiftでTooltipを書いた
こうゆうツールチップを書きました。
こんな感じに書けます。 本当はもう少し描画周りのリファクタしたりカスタマズ性を持たせたりしたいが、そもそも自分が使わないのでこの辺でアウトプットします。
private let toolTip = TooltipView(option: Option( fillColor: UIColor(0xf59542) attributeText: NSAttributedString( string: "Top: #f59542", attributes: [ .foregroundColor: UIColor.white, .font: UIFont.systemFont(ofSize: 14), ] ), padding: UIEdgeInsets(top: 2, left: 4, bottom: 2, right: 4), arrowPosition: .bottom(normalizedPointX: 0.4) ))