MKToolTip
is a customizable tooltip view written in Swift that can be used as a informative tip.
To integrate MKToolTip into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'MKToolTip'
Then, run the following command:
$ pod install
If you prefer not to use dependency managers, you can integrate MKToolTip into your project manually.
- First you should customize the preferences:
let gradientColor = UIColor(red: 0.886, green: 0.922, blue: 0.941, alpha: 1.000)
let gradientColor2 = UIColor(red: 0.812, green: 0.851, blue: 0.875, alpha: 1.000)
var preferences = Preferences()
preferences.drawing.bubbleGradientColors = [gradientColor.cgColor, gradientColor2.cgColor]
preferences.drawing.arrowTipCornerRadius = 0
preferences.drawing.messageColor = .black
- Secondly call the
show(view: identifier: title: message: arrowPosition: preferences: delegate:)
method:
MKToolTip.show(view: button1, identifier: "identifier", title: "Dapibus", message: "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.", arrowPosition: .top)
###Delegate
public protocol MKToolTipDelegate: class {
func toolTipViewDidAppear(for identifier: String)
func toolTipViewDidDisappear(for identifier: String, with timeInterval: TimeInterval)
}
###Public methods
public class func show(item: UIBarItem, identifier: String, title: String? = nil, message: String, arrowPosition: ArrowPosition, preferences: Preferences = Preferences(), delegate: MKToolTipDelegate? = nil)
public class func show(view: UIView, identifier: String, title: String? = nil, message: String, arrowPosition: ArrowPosition, preferences: Preferences = Preferences(), delegate: MKToolTipDelegate? = nil)
MIT License, Copyright (c) 2018 Metin Kilicaslan, @metinkilicaslan