58

GitHub - metinkilicaslan/MKToolTip

 5 years ago
source link: https://github.com/metinkilicaslan/MKToolTip
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

Languages

Description

MKToolTip is a customizable tooltip view written in Swift that can be used as a informative tip inside your both Swift and Objective-C projects.

MKToolTip.gif

Installation

CocoaPods

To integrate MKToolTip into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'MKToolTip'

Then, run the following command:

$ pod install

Manually

If you prefer not to use dependency managers, you can integrate MKToolTip into your project manually.

Usage

  1. 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)
let preference = ToolTipPreferences()
preference.drawing.bubble.gradientColors = [gradientColor, gradientColor2]
preference.drawing.arrow.tipCornerRadius = 0
preference.drawing.message.color = .black
  1. Secondly call the showToolTip(identifier: title: message: arrowPosition: preferences: delegate:) method:
let view = UIView()
view.showToolTip(identifier: "identifier", title: "Dapibus", message: "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.", arrowPosition: .top)

Public interface

Delegate

public protocol MKToolTipDelegate: class {
    func toolTipViewDidAppear(for identifier: String)
    func toolTipViewDidDisappear(for identifier: String, with timeInterval: TimeInterval)
}

Public extension methods

public extension UIView {
    public func showToolTip(identifier: String, title: String? = nil, message: String, arrowPosition: MKToolTip.ArrowPosition, preferences: ToolTipPreferences = ToolTipPreferences(), delegate: MKToolTipDelegate? = nil)
}

public extension UIBarItem {
    public func showToolTip(identifier: String, title: String? = nil, message: String, arrowPosition: MKToolTip.ArrowPosition, preferences: ToolTipPreferences = ToolTipPreferences(), delegate: MKToolTipDelegate? = nil)
}

License

MIT License, Copyright (c) 2018 Metin Kilicaslan, @metinkilicaslan


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK